将内联Javascript收集到单个脚本中

时间:2013-04-15 17:47:11

标签: javascript jquery

jQuery新手。主要是喜欢它,但在将我的所有页面命令编译成单个.js文档时遇到了一些麻烦。

当我尝试将以下任何命令从页头移动到functions.js时,它们最好停止工作,最坏的情况也会干扰其他功能。

我该如何清理它?

<!-- leanModal -->
<script type="text/javascript" src="_/js/jquery.leanModal.min.js"></script>
<script type="text/javascript">
        $(function() {
            $('a[rel*=leanModal]').leanModal({ top : 70, closeButton: ".modal_close" });    

        });
</script>

<!-- sticky -->
<script src="_/js/jquery.sticky.min.js"></script>
<script>
        $(window).load(function(){
            $("#chapters").sticky({ topSpacing: 54 });
        });
</script>

<!-- customSelect -->
<script type="text/javascript" src="_/js/jquery.customSelect.min.js"></script>
<script type="text/javascript">
    $(function(){
        $('#risk select').customSelect();
    });
</script>

<!-- happy.js -->
<script src="_/js/happy.js"></script>
<script src="_/js/happy.methods.js"></script>
<script>
  $(document).ready(function () {
    $('#consultation, #risk').isHappy({
      fields: {
        '#consultation-name': {
          required: true,
          message: 'Please share your name'
        }, 
        '#risk-email': {
          required: true,
          message: 'Please share your email'
        } 
      }
    });
  }); 
</script>

0 个答案:

没有答案