V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
fuwu1245
V2EX  ›  问与答

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

  •  
  •   fuwu1245 · 2015-07-23 14:04:54 +08:00 · 2172 次点击
    这是一个创建于 3199 天前的主题,其中的信息可能已经有所发展或是发生改变。
    http://123.131.128.102:2345/about.html

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

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


    按照自己对JQuery的理解,改了下,还是有几率出现宽度过大的情况
    ctrl+F5强制刷新,基本上不会出现这种情况。。
    各位前辈帮忙看下,Bug的原因在哪?
    3 条回复    2015-07-23 14:24:19 +08:00
    witcher42
        1
    witcher42  
       2015-07-23 14:17:06 +08:00   ❤️ 1
    把你的 css 放到所有 js 的前面...
    witcher42
        2
    witcher42  
       2015-07-23 14:19:03 +08:00   ❤️ 1
    看一下 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
        3
    fuwu1245  
    OP
       2015-07-23 14:24:19 +08:00
    @witcher42 OK了。。。不懂前端还被弄去干前端就是我这个结果了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4526 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 04:05 · PVG 12:05 · LAX 21:05 · JFK 00:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.