简体   繁体   English

jQuery + ie7 =未定义

[英]jquery + ie7 = undefined

i'm having strange problem in ie7 with a jquery. 我在用jQuery的IE7中遇到了奇怪的问题。 the problem occurs only in IE7. 该问题仅在IE7中出现。 In short (ie9 compatibility turn to ie7) console window shows that jQuery is not defined - however jQuery (1.7.1) is loaded (from disk not cdn) and i can view it from debug window in IE. 简而言之(ie9兼容性转到ie7)控制台窗口显示未定义jQuery-但是已加载jQuery(1.7.1)(从磁盘而不是cdn),我可以从IE中的调试窗口查看它。

yo can view page here: 您可以在这里查看页面:
http://karolwasik.pl/works/familypark/ http://karolwasik.pl/works/familypark/

there's only a few lines of code js used with default html5boilerplate package (like modernizr), also i've used jQuery Cycle Plugin. 默认的html5boilerplate包(如modernizr)只使用​​了几行js代码,我也使用了jQuery Cycle Plugin。

these few lines are (so you can see that additional coma is not the issue ;) ): 这几行是(所以您可以看到,其他昏迷不是问题;)):

/* Author: karolwasik.pl */
$(function(){

$('#batonP').on('click',function(e){
    e.preventDefault()
    h = $('#subpC .slajdM').height()
    log(h)
    log($(this))
    if(h!==633){
        $('#subpC .slajdM').stop().animate({'height': 633}, 150)
        $(this).removeClass('nieaktywny').addClass('aktywny')
    } else {
        $('#subpC .slajdM').stop().animate({'height': 233}, 150)
        $(this).removeClass('aktywny').addClass('nieaktywny')
    }
})
if($('#frontnav').length){
    fv = $('#frontnav').find('li').get()
    //$('#frontnav').html('')
    $('#mainC').cycle({ 
        fx:     'fade', 
        speed:  1000, 
        timeout: 0,
        next: '.nextS',
        pager: '#frontnav',
        pagerAnchorBuilder: function(idx, slide) {  
            return $(fv[idx]); 
        }    
    }); 
}
})

You have imported all these files after the footer. 您已在页脚之后导入所有这些文件。

<!-- scripts concatenated and minified via ant build script-->
  <script defer src="js/libs/jquery-1.7.1.min.js"></script>  
  <script defer src="js/libs/jquery.cycle.all.js"></script>  
  <script defer src="js/plugins.js"></script>
  <script defer src="js/script.js"></script>
  <!-- end scripts-->

where as the the modernizr is there in the beginning. 最初是现代化的地方。 I would suggest to move all the scripts on the header. 我建议将所有脚本移到标题上。 try to keep the modernizr at the bottom or in the middle of the above scripts and check if it works. 尝试将modernizr放在上述脚本的底部或中间,并检查其是否有效。

so actually answer is under defer term. 所以实际上答案是延期的。 accidentally i found this topic where problem is basically the same. 偶然地,我发现这个主题的问题基本上是相同的。

<script defer> and $(document).ready <脚本延迟>和$(document).ready

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM