4

我使用的是單個項目中引導和的fancybox,包括像這樣使用引導和的fancybox:在單個項目中

<script src="http://code.jquery.com/jquery-latest.js"></script> 
<script src="js/bootstrap.min.js"></script> 
<script src="fancybox/jquery.fancybox-1.3.4.pack.js"></script> 

該文件存在,並且得到了包括由Chrome。

當創建的fancybox元素:

$(document).ready(function() { 
    [...] 

    jQuery("a.fancy").fancybox({ 
     'transitionIn' : 'none', 
     'transitionOut' : 'none'  
    }); 
}); 

JS拋出一個錯誤:

Uncaught TypeError: Cannot read property 'msie' of undefined jquery.fancybox-1.3.4.pack.js:18 
Uncaught TypeError: Object [object Object] has no method 'fancybox' 

(自舉功能工作)

這是一個命名空間的問題?

+1

的[的fancybox不使用jQuery v1.9.0工作]可能重複(http://stackoverflow.com/questions/14344289/fancybox-doesnt-work-with-jquery-v1-9- 0) – JFK

+1

你正在使用'http:// code.jquery.com/jquery-latest.js'這樣檢查http://stackoverflow.com/q/14344289/1055987 – JFK

回答

2

在fancybox被調用之前DOM是否被加載?如果不試試這個:

$(document).ready(function() { 
    $('a.fancy').fancybox({ 
     'transitionIn' : 'none', 
     'transitionOut' : 'none' 
    }); 
}); 
+0

是的,它正如前面提到的那樣糾正它,對不起。 – GregorVolkmann

0

我剛剛通過軟件包更新。

看起來像最新版本的jQuery不再支持($ .browser)。 jQuery文檔推薦使用Modernizr

我用this它運行良好。

jQuery 1.9 docs

相關問題