会前端的来一下,有一个页面动画的小 Bug。。

2015-07-23 14:04:54 +08:00
 fuwu1245
http://123.131.128.102:2345/about.html

这个页面的导航动画有一点问题,栏目下面的蓝色导航条的宽度会出现获取宽度过大的问题
如图,本来应该是这个样子

但是,有时候会出现这种情况


按照自己对JQuery的理解,改了下,还是有几率出现宽度过大的情况
ctrl+F5强制刷新,基本上不会出现这种情况。。
各位前辈帮忙看下,Bug的原因在哪?
2182 次点击
所在节点    问与答
3 条回复
witcher42
2015-07-23 14:17:06 +08:00
把你的 css 放到所有 js 的前面...
witcher42
2015-07-23 14:19:03 +08:00
看一下 jQuery ready 的文档 http://api.jquery.com/ready/

> The handler passed to .ready() is guaranteed to be executed after the DOM is ready, so this is usually the best place to attach all other event handlers and run other jQuery code. When using scripts that rely on the value of CSS style properties, it's important to reference external stylesheets or embed style elements before referencing the scripts.
fuwu1245
2015-07-23 14:24:19 +08:00
@witcher42 OK了。。。不懂前端还被弄去干前端就是我这个结果了

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/207795

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX