[英]jQuery Slide menu hover action
ok thing is like this, I got 2 divs , one is my navigation , the other got the same number of li tags with almost same id's as my navigation, those li tags contains a graphic that suppose to slide when hover the nav. 好的事情是这样的,我有2个div ,一个是我的导航 ,另一个是具有与我的导航几乎相同的id的相同数量的li标签,这些li标签包含一个图形 ,该图形假定在导航时会滑动 。 Let me explain...
让我解释...
this is my nav 这是我的导航
<ul id="navInside">
<li><a id="nInicio" href="index.php" >Inicio</a></li>
<li><a id="nHistoria" href="history.php" >Historia</a></li>
<li><a id="nQuienes" href="aboutus.php" >Quienes somos</a></li>
this is what should move 这是应该移动的
<ul id="navSlides">
<li id="SnInicio"></li>
<li id="SnHistoria"></li>
<li id="SnQuienes"></li>
This is the jQuery code i got now.... 这是我现在得到的jQuery代码。
$('#navInside li').hover(function (){
$("#S" + this.id).animate({top: '0px'}, 500)}, function (){
$("#S" + this.id).animate({top: '-70px'}, 500, 'swing');}
);
Can you help me get the right selector for this to work? 您能帮我找到合适的选择器吗?
I been stuck for days... Thank you 我被困了好几天...谢谢
The id
is on the anchor, not the <li>
(which this
refers to) so your hover should be: id
位于锚点上,而不是<li>
( this
指的是)上,因此您的悬停应该是:
$('#navInside li a').hover(function (){
$("#S" + this.id).animate({top: '0px'}, 500);
}, function (){
$("#S" + this.id).animate({top: '-70px'}, 500, 'swing');
});
Or, use the code you have and move the id
up to the <li>
, like this: 或者,使用您拥有的代码并将
id
移至<li>
,如下所示:
<ul id="navInside">
<li id="nInicio"><a href="index.php" >Inicio</a></li>
<li id="nHistoria"><a href="history.php" >Historia</a></li>
<li id="nQuienes"><a href="aboutus.php" >Quienes somos</a></li>
Excuse me, I am unclear as to what $("#S" + this.id) is? 对不起,我不清楚$(“#S” + this.id)是什么? I don't see id="S" anywhere else in the html...
我在HTML的其他任何地方都看不到id =“ S”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.