using a value from where the mouse pointer is
hi,
i have more rows with different users and i want to get the user id from where the mouse pointer is and land it in the image source of mini_profile div
this stupid code of mine looks like this
php file
- echo "<span class='hover'>".$row1['name']."<span class='id_user' style='transparency:1%;'>".$row1['id_user']."</span></span>";
- echo "<span class='hover'>".$row2['name']."<span class='id_user' style='transparency:1%;'>".$row2['id_user']."</span></span>";
- <div id="mini_profile" style="display:none;position:absolute"><img src="/img/u<?php echo $row 1 or 2 depending where the mouse cursor is ['id_user'] ?>.png" ></div>
js file
- $(function(){
- $(document).mousemove( function(e) {
- mouseX = e.pageX;
- mouseY = e.pageY;
- });
- $(".hover").hover(function(){
- //$("#mini_profile").text($(this).text());
- $("#mini_profile").css({'top':mouseY,'left':mouseX}).show();
- },
- function(){
- $("#mini_profile").fadeOut(500);
- });
- });
so any ideas how to make this more logical, because i think it is very twisted
thank you,
Dan.