如何实现 js中tips 鼠标碰触时不消失,离开时消失

如何实现 js中tips 鼠标碰触时不消失,离开时消失,第1张

延迟2s消失的话加个定时器

$(function(){

$('#webmenu li').hover(function(){

$(this).children('ul').stop(true,true).show('slow')

},function(){

var self = this

setTimeout(function() {

$(self).children('ul').stop(true,true).hide('slow')

}, 2000)

})

要是鼠标离开到消失是2s

$(function(){

$('#webmenu li').hover(function(){

$(this).children('ul').stop(true,true).show('slow')

},function(){

$(this).children('ul').stop(true,true).hide(2000)

})

其实就是显示与隐藏. JS的语句是可以捕捉元素的,比如document.form1.div1 设置style中的display,none就是隐藏,block就是显示. function show() { document.getElementById("div1").style.display = "block"} function hide() { document.getEl...


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/11192520.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存