jQuery:自动触发悬停

jQuery:自动触发悬停,第1张

概述我有一个悬停鼠标mouseout设置如下列表项:$('#main-nav li a').hover(function() { $el = $(this); leftPos = $el.position().left; newWidth = $el.parent()

我有一个悬停鼠标mouSEOut设置如下列表项:

$("#main-nav li a").hover(function() {                $el = $(this);                leftPos = $el.position().left;                newWIDth = $el.parent().wIDth();                $magicNav.stop().animate({                    left: leftPos,wIDth: newWIDth                });            },function() {                t1 = $(".current-menu-item a").position().left;                t2 = $(".current-menu-item a").parent().wIDth();                $magicNav.stop().animate({                    left: t1,wIDth: t2                });                });

我想在有人进入网站或加载页面时自动触发“.current-menu-item a”上的悬停.

目前,我使用$(“.current-menu-item a”).触发器(‘hover’);它不起作用.

救命?

最佳答案用这个

$(document).ready(function(){    $(".current-menu-item a").mouSEOver();});

要么

$(window).load(function(){    $(".current-menu-item a").mouSEOver();});
总结

以上是内存溢出为你收集整理的jQuery:自动触发悬停全部内容,希望文章能够帮你解决jQuery:自动触发悬停所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

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

原文地址: https://outofmemory.cn/web/1123895.html

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

发表评论

登录后才能评论

评论列表(0条)

保存