Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pozitie fixa fata de cursor
#2
Poti folosi mousemove in jquery ca sa actualizezi pozitia unui div ascuns initial dar afisat cu show().

Apoi cand cursorul iasa din browser divul redevine ascuns.
Pentru inceput ar trebui sa iti fie bun urmatorul cod:
PHP Code:
<html>
<
head>
<
script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
    $(document).mousemove(function(e){
        $("#box").show();
        var top = e.pageY + 20;
        var left = e.pageX + 20;
        $("#box").css("top", top);
        $("#box").css("left", left);
    });
    $(document).mouseout(function(e){
        $("#box").hide();    
    });

});
</script>
<style>
#box{
    display:none;
    border:1px solid #000;
    position:fixed;
    left:10px;
    top:10px;
    right:auto;
    bottom:auto;
    
}
</style>
</head>
<body>
<div id="box">
Mouse tip
</div>

</body>
</html> 
Reply


Messages In This Thread
Pozitie fixa fata de cursor - by nickname - 05-08-2012, 08:51 PM
RE: Pozitie fixa fata de cursor - by Admin - 05-15-2012, 10:08 PM
RE: Pozitie fixa fata de cursor - by nickname - 05-19-2012, 11:50 AM
RE: Pozitie fixa fata de cursor - by Admin - 05-20-2012, 03:20 AM
RE: Pozitie fixa fata de cursor - by nickname - 05-20-2012, 11:35 AM



Users browsing this thread: 1 Guest(s)