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

求大神帮我合并下这 2 个 jq 的$(document).ready(function()部分

  •  
  •   shpasspass · 2014-05-26 17:25:28 +08:00 · 3464 次点击
    这是一个创建于 3626 天前的主题,其中的信息可能已经有所发展或是发生改变。
    ===================第一个是=====================
    <script type="text/javascript">
    $(document).ready(function(){
    $(".logo a").hover(function(){
    $(this).find(".shine").stop();
    $(this).find(".shine").css("background-position","-177px 0");
    $(this).find(".shine").animate({backgroundPosition: '177px 0'},600);
    $(this).find(".title").stop().animate({left:'0px'},{queue:false,duration:450});
    },function(){
    $(this).find(".title").stop().animate({left:'-160px'},{queue:false,duration:200});
    });
    });
    </script>
    ==============第2个是===========
    <script type="text/javascript">
    $(document).ready(function() {
    $("#sfloat").scrollFollow({
    bottomObj: '.index-w-box',
    marginTop: 8,
    marginBottom: 0
    })
    });
    </script>
    ========================
    主要是页面中有2个$(document).ready(function() 结果导致只有第2个生效,第一个不生效。谢谢了
    7 条回复    2014-05-26 17:44:24 +08:00
    JoyNeop
        1
    JoyNeop  
       2014-05-26 17:34:24 +08:00 via iPad   ❤️ 1
    @Livid RSS 输出似乎过滤不严?http://joyneop.tumblr.com/post/86882431770
    loading
        2
    loading  
       2014-05-26 17:37:06 +08:00 via Android   ❤️ 1
    <script type="text/javascript">
    $(document).ready(function(){
    $(".logo a").hover(function(){
    $(this).find(".shine").stop();
    $(this).find(".shine").css("background-position","-177px 0");
    $(this).find(".shine").animate({backgroundPosition: '177px 0'},600);
    $(this).find(".title").stop().animate({left:'0px'},{queue:false,duration:450});
    },function(){
    $(this).find(".title").stop().animate({left:'-160px'},{queue:false,duration:200});
    });


    $("#sfloat").scrollFollow({
    bottomObj: '.index-w-box',
    marginTop: 8,
    marginBottom: 0
    });

    });
    </script>



    你是真的什么都不懂吗?
    Paranoid
        3
    Paranoid  
       2014-05-26 17:38:05 +08:00   ❤️ 1
    你确定不是代码的问题???? 2 个 $(document).ready(function(){}) 一点关系都没有 !!!!!
    akfish
        4
    akfish  
       2014-05-26 17:38:53 +08:00   ❤️ 1
    @loading via Android,ls对这种伸手党还真有耐心。。。。
    loading
        5
    loading  
       2014-05-26 17:42:19 +08:00 via Android
    @akfish 是的,刚好无聊,我在看他发过的帖子,是不是要block掉
    loading
        6
    loading  
       2014-05-26 17:43:46 +08:00 via Android
    @Paranoid 嘘!
    shpasspass
        7
    shpasspass  
    OP
       2014-05-26 17:44:24 +08:00
    jq是没学过,因为以前用网上找的js素材,也是这类问题,所以我想jq也应该是这类问题了。谢谢了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   958 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:54 · PVG 05:54 · LAX 14:54 · JFK 17:54
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.