文字忽隐忽现的jQuery代码加入变量出现错误
- JScript code
$(document).ready(function(){ var a=true $('p').mousemove(function(event){ if a=true { a=false; $(event.target).fadeOut(200) ; $(event.target).fadeIn(100) ; a=true; } });});提示 a=false 错误,这样不行么?
[解决办法]
$(document).ready(function(){
var a=true
$('p').mousemove(function(event){
if( !$(event.target).is(":animated") ){
if (a==true) {
a=false;
$(event.target).fadeOut(200) ;
$(event.target).fadeIn(100) ;
a=true;
}
}
});
});
试试
[解决办法]
- JScript code
$(document).ready( function() { $('p').mousemove( function() { if (!$(this).is(":animated")) $(this).fadeOut(200, function() { $(this).fadeIn(100); }); });});