Javascript 如何向jquery事件添加函数
在mouseover事件中,我想调用这个函数,当鼠标停留在图像上时,它会做一些事情,但我不知道如何为它编写代码Javascript 如何向jquery事件添加函数,javascript,jquery,events,Javascript,Jquery,Events,在mouseover事件中,我想调用这个函数,当鼠标停留在图像上时,它会做一些事情,但我不知道如何为它编写代码 function reload(){ $("img.lazy").lazyload({ effect : "fadeIn", event:"mouseover" }); } 例如: 您想使用鼠标指针: $('.test')。在('mouseenter',function()上{ 警惕(‘鼠标在这里’); });
function reload(){
$("img.lazy").lazyload({
effect : "fadeIn",
event:"mouseover"
});
}
例如:
您想使用
鼠标指针
:
$('.test')。在('mouseenter',function()上{
警惕(‘鼠标在这里’);
});代码>
将鼠标悬停在此处
您想使用鼠标指针
:
$('.test')。在('mouseenter',function()上{
警惕(‘鼠标在这里’);
});代码>
将鼠标悬停在此处
让我们看看这是否适合您
$(function() {
$("img.lazy")
.mouseover(function() {
console.log("Mouseover");
});
});
让我们看看这对你是否有效
$(function() {
$("img.lazy")
.mouseover(function() {
console.log("Mouseover");
});
});
你会喜欢这个的
jQuery('#youdomid').hover(function(){
// do your stuff here
//, your mouse has entered
alert(2);
},
function (){
// your mose leave the element
// do the stuff what you want
alert("leaved");
}
)
你会喜欢这个的
jQuery('#youdomid').hover(function(){
// do your stuff here
//, your mouse has entered
alert(2);
},
function (){
// your mose leave the element
// do the stuff what you want
alert("leaved");
}
)
您还可以使用.hover函数
$( "img.lazy" ).hover(function() {
$( this ).fadeOut( 100 );
$( this ).fadeIn( 500 );
});
您还可以使用.hover函数
$( "img.lazy" ).hover(function() {
$( this ).fadeOut( 100 );
$( this ).fadeIn( 500 );
});
您只需使用下面的事件mouseenter
:
$('.lazy').on('mouseenter', function() {
console.log('foo');
});
您只需使用下面的事件mouseenter
:
$('.lazy').on('mouseenter', function() {
console.log('foo');
});