-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathjQuery-OnHover-show-POPUP
33 lines (23 loc) · 1.15 KB
/
jQuery-OnHover-show-POPUP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!-- To test this in live, add RunFor in front of github.com -->
<a href="#" id="MyTrigger">Hover on this link</a>.
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" ></script>
<style type="text/css">
#MyAudDownPop{display:none; position:absolute; width:280px; padding:10px; background:#eeeeee; color:#000000; border:1px solid; font-size:90%;}
</style>
<script type="text/javascript">
function MyHintDispp() {
var moveLeft = 20;
var moveDown = 10;
$('#MyTrigger').hover(function(e) {
$('#MyTrigger').click(function(e) { e.preventDefault(); }); //disable Default Click action
$('body').append('<span id="MyAudDownPop">Your messageeeeeeeeee </span>'); //create element manually
$('#MyAudDownPop').show();
$('#MyAudDownPop').css({'top': e.pageY + moveDown, 'left': e.pageX + moveLeft});
}, function() {
//$('#MyAudDownPop').hide();
$('#MyAudDownPop').remove();
});
$('#MyTrigger').mousemove(function(e){ $("#MyAudDownPop").css({'top' :e.pageY + moveDown, 'left':e.pageX + moveLeft});});
};
$(function() { MyHintDispp(); }); //Trigger After Jquery(+elements) is loaded
</script>