2013-02-22 103 views
0

請開發人員,我做了一切反覆,似乎無法找出爲什麼fancybox插件拒絕工作。我認爲它的下面的JavaScript假設啓動插件。Fancybox不能使用簡單的鏈接

<script type="text/javascript"> 
$(document).ready(function() { 

    /* This is basic - uses default settings */ 

    $("a#contactus").fancybox(); 

    /* Using custom settings */ 

    $("a#inline").fancybox({ 
     'hideOnContentClick': true 
    }); 

    /* Apply fancybox to multiple items */ 

    $("a.group").fancybox({ 
     'transitionIn' : 'elastic', 
     'transitionOut' : 'elastic', 
     'speedIn'  : 600, 
     'speedOut'  : 200, 
     'overlayShow' : false 
    }); 

}); 
</script> 
+0

[Fancybox無法使用jQuery v1.9.0 \ [f.browser is undefined/Can not read property'msie'\]](http://stackoverflow.com/questions/14344289/fancybox-doesnt -work-with-jquery-v1-9-0-f-browser-is-undefined-無法讀取) – JFK 2013-02-22 03:11:57

+0

如何解決它http://stackoverflow.com/a/14344290/1055987 – JFK 2013-02-22 03:12:20

回答

0

打開控制檯(F12)並注意錯誤?

Fancybox似乎使用$.browser,它在jQuery 1.9中被刪除,這是一個錯誤!

另外,$("a#contactus").fancybox();是錯誤!有沒有這樣的元素,你確實有一個與該ID的div?

+0

確定那麼什麼版本的jquery我需要 – Jes 2013-02-22 03:07:37

+0

是的div是在那裏,但是當你去的網站,你必須點擊白色按鈕 – Jes 2013-02-22 03:08:32

+0

你的目標是一個具有該ID的錨點,而不是一個div。至於jQuery,你需要一個1.9之前的版本,或者看看fancybox是否有最新的東西,可以使用1.9,或者使用[瀏覽器shim](http://greatwebguy.com/jquery-2/browser-detection勻場換的jquery-1-9 /)。 – adeneo 2013-02-22 03:10:11