JQuery ul li 单击移至列表中的下一个
好的,差不多到了,希望使用 Jquery 和 css 类(图像)在 HTML ul li 列表中上下导航,就像选择选项下拉列表的工作方式一样,只想只显示 1 个项目,而不是下拉按钮,但是下一个/上一个 css 类,用于处理列表,一次只显示一个项目,因此整个效果有点像旋转器。例如,
$('.next').click (function( MOVE TO NEXT ITEM IN LIST ))
$('.prev').click (function( MOVE TO PREV ITEM IN LIST ))
请提供类似于
<ul class="">
<li> Item 1</li>
<li> Item 2</li>
<li> Item 3</li>
<li> etc ....
</ul>
<img src="but..." class="next">
<img src="but..." class="prev">
“建议”的列表 - 提前致谢
OK, nearly there, looking to use Jquery and css class (images) to navigate up and down an HTML ul li list in the same way a select option drop down works only want to only display 1 item, not a drop down button, but a next/prev css class to work though the list with only one item showing at a time so the whole effect is a bit like a spinner. e.g.
$('.next').click (function( MOVE TO NEXT ITEM IN LIST ))
$('.prev').click (function( MOVE TO PREV ITEM IN LIST ))
with a list a bit like
<ul class="">
<li> Item 1</li>
<li> Item 2</li>
<li> Item 3</li>
<li> etc ....
</ul>
<img src="but..." class="next">
<img src="but..." class="prev">
Suggestions please - and thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
人们在发布代码之前需要检查他们的代码!上述答案都不起作用。
我修复它:
People need to check their code before posting it! Neither of the above answers work.
I fixt it:
现在,使用
getActive()
获取活动列表元素。更新:如果您想隐藏除活动列表项之外的所有项目,只需添加:
Now, use
getActive()
to get the active list element.UPDATE: if you want to hide all items except the active list item, just add:
如果我正确理解你的问题,你一次只需要 1 个列表元素可见。为此,我将修改大卫答案中的函数来执行类似的操作。
If I understand your question correctly you only want 1 list element at a time to be visible. To do this I would modify the functions from David's answer to do something like this.