jQuery - 改进/减少我的 iPod 风格的下拉代码! - 挑战?
从中汲取灵感
http://www.filamentgroup.com/examples/menus/ipod .php
我从头开始制作了自己的解决方案,因为我需要为客户提供这个聪明的下拉解决方案,但更轻量级和更简单。高效的!
所以我手里拿着一杯好咖啡,做了这个
因为这是一个概念证明,在将其移植到之前,很高兴知道一个插件,你觉得怎么样!
是好是坏还是可以改进或缩小尺寸!?
我很高兴与您分享此代码,如果您想给我任何反馈,我会很高兴! ;-)
PS:在 IE6+、Firefox、 Chrome、Opera,当然还有支持 jQuery 主题滚轮并且具有零配置步骤!
谢谢你们!
by keeping inspiration from this
http://www.filamentgroup.com/examples/menus/ipod.php
i have maked my own from scratch cause i have needed this smarty dropdown solution for a client, but more lightweight & efficient!
so with a good cup of coffe in my hand i have maked this
since this is a proof o concept, whould be nice to know, before port this into a plugin, what you think about it!
is good, bad or can be improved or reduced in size!?
i'm glad to share this code with you and would be nice if you want give me any feedback! ;-)
PS: work perfectly in IE6+, Firefox,
Chrome, Opera and of course support
the jQuery Theme Roller and have zero configuration steps!
thank you guys!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来不错。
我想说的一件事是,如果您要多次使用 jQuery 对象,则应该尝试将它们存储在变量中,并尝试利用链接。
就像代码开头这样:
还有这样:
另外,在几个地方,您可以同时使用
prevAll()
和prevNext()
,而您可以只使用兄弟姐妹()
。就像这里一样:
此外,当您第一次将鼠标悬停在菜单项上时,会发生一点点向下的情况。我认为这是因为悬停的项目正在获得一个边框,而之前没有边框。
您可能需要重新调整所有菜单项的大小,以便它们都可以具有与背景颜色匹配的边框。然后,当您将鼠标悬停在其中一个上时,您只是改变了它的颜色。
不过整体看起来不错。
Looks nice.
One thing I'd say you should try to store jQuery objects in a variable if you're going to use them more than once, and try to take advantage of chaining.
Like this at the beginning of the code:
And this:
Also, in a couple of places, you use
prevAll()
andprevNext()
together, when you could just usesiblings()
.Like here:
Also, when you first hover over a menu item, there's a little jog downward that happens. I assume this is because the hovered item is getting a border where there wasn't one before.
You may want to re-size all the menu items so they can all have a border that matches the background color. Then when you hover over one, you're just changing its color.
Looks nice overall though.