Why mouse over function not work when use with javascript load content ?
mouse over function like this
i want to use function mouse over in page : test5.php
but not work , How can i do ?
index.php
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">//<![CDATA[
$(window).load(function(){
$('#love-trigger').on({
mouseenter: function(e) {
if (e.target.id == 'love-trigger') $('#love-box').animate({
top: '0px' , opacity: 1
}, 100);
clearTimeout( $('#love-box').data('timer') );
if (e.target.id == 'love-trigger') $('.notch').animate({
top: '33px' , opacity: 1
}, 100);
clearTimeout( $('.notch').data('timer') );
},
mouseleave: function() {
$('#love-box').data('timer',
setTimeout(function() {
$('#love-box').animate({
top: '10px' , opacity: 0
}, 100);
}, 1000)
);
$('.notch').data('timer',
setTimeout(function() {
$('.notch').animate({
top: '35px' , opacity: 0
}, 100);
}, 1000)
);
}
});
});//]]>
</script>
<style type="text/css">
#love-box{
position: relative;
opacity: 0;
filter: alpha(opacity = 0);
top: 10px;
}
</style>
<div id="love-box" class="love-box_text">
Star Star
<b class="notch"></b>
</div>
<img src="http://www.i2symbol.com/images/symbols/stars/outlined_black_star_u272D_icon_256x256.png" id="love-trigger" style=" margin-left: 28px; height: 62px;"/>
<br>
this is fucntion on index.php (Show "Star Star" When mouse over)
<br><br><br><br><br>
<script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var username = $("#username").val();
// you can check the validity of username and password here
$.post("test5.php",{username:username},
function(data) {
$('#results').html(data);
});
});
</script>
<div id="results" style=" width: 100%; ">
</div>
this is fucntion on test5.php (not work! How to do ?)
test5.php
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">//<![CDATA[
$(window).load(function(){
$('#love-trigger').on({
mouseenter: function(e) {
if (e.target.id == 'love-trigger') $('#love-box').animate({
top: '0px' , opacity: 1
}, 100);
clearTimeout( $('#love-box').data('timer') );
if (e.target.id == 'love-trigger') $('.notch').animate({
top: '33px' , opacity: 1
}, 100);
clearTimeout( $('.notch').data('timer') );
},
mouseleave: function() {
$('#love-box').data('timer',
setTimeout(function() {
$('#love-box').animate({
top: '10px' , opacity: 0
}, 100);
}, 1000)
);
$('.notch').data('timer',
setTimeout(function() {
$('.notch').animate({
top: '35px' , opacity: 0
}, 100);
}, 1000)
);
}
});
});//]]>
</script>
<style type="text/css">
#love-box{
position: relative;
opacity: 0;
filter: alpha(opacity = 0);
top: 10px;
}
</style>
<div id="love-box" class="love-box_text">
Star Star
<b class="notch"></b>
</div>
<img src="http://www.i2symbol.com/images/symbols/stars/outlined_black_star_u272D_icon_256x256.png" id="love-trigger" style=" margin-left: 28px; height: 62px;"/>