jQuery 幻灯片和显示/隐藏 div
以上是我正在设计的网站的一部分。通常的 jQuery 幻灯片功能工作得很好,但我想更进一步。
单击其中一张发行图像后,会出现一个 div,显示更大的艺术作品、曲目列表和一些其他信息。当此打开时,如果单击另一个版本,我希望旧部分隐藏,新部分立即替换它。目前我的 jQuery 遇到了问题。
如果.length> 1 内容按我想要的方式显示,但如果为 0,则初始内容不会滑动,它只是显示,但您可以在版本之间交换。这是我第一次尝试创建自己的脚本,正如您可能会说的那样,说实话,仅让各个部分向上或向下滑动的原始实现就足够了,但我想改进我的工作。谢谢
Above is part of a website I am designing. The usual jQuery slide functions work fine but I would like to take it a step further.
Upon clicking one of the release images a div appears showing larger artwork, tracklisting and some other information. When this is open if another release is clicked I would like the old section to hide and the new section to replace it immediately. At the minute I am having trouble with my jQuery.
If .length > 1 the content appears as I would like but if it is 0 the initial content doesn't slide, it just appears but you can swap between the releases. This is the first time I've tried to create my own script as you can probably tell and to be honest the original implementation of just having the sections slide up or down over each other was sufficient but I am wanting to better my work. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你只需要改变你的条件:
不要检查选择器结果的长度。
#harris
和#amy
始终位于 DOM 中,因此始终会输入 true 条件。更新示例:http://jsfiddle.net/uwmtN/
I think you just need to change your condition:
Don't check the length of the results of your selector. Both
#harris
and#amy
are always in the DOM, so the true condition will always be entered.Updated example: http://jsfiddle.net/uwmtN/