我在開發一個網站上遇到腳本問題。它在Safari,Opera和Chrome中運行良好,但在Firefox中不起作用。Jquery加載在Firefox中不工作
當你點擊一個鏈接時,我嘗試從內部鏈接加載到div覆蓋div,然後取消隱藏。所有這些在我上面提到的瀏覽器中工作正常,但它不會在Firefox中工作,點擊功能只是打開鏈接(重新加載頁面),就像它通常會做的那樣。
任何想法,爲什麼它不適用於Firefox?任何我缺少的東西?
$(document).ready(function(){
var $ov = $('.overlay'),
$tp = $('#transparent'),
URL = ' ',
siteURL = "http://" + top.location.host.toString(),
$internal = $("a[href^='"+siteURL+"'], a[href^='/'], a[href^='./'], a[href^='../'], a[href^='#']:not('.no')"),
hash = window.location.hash,
$el, $allLinks = $("a");
$tp.hide();
$ov.hide();
$tp.click(function(){
$ov.empty();
$tp.hide();
$ov.hide();
});
if (hash) {
$ov.show();
$tp.show();
hash = hash.substring(1);
URL = hash + " #contain";
$ov.load(URL);
};
$internal.each(function(){
$(this).attr("href", "#" + this.pathname);
}).click(function(){
$tp.show();
$ov.show();
$el = $(this);
URL = $el.attr("href").substring(1);
URL = URL + " #contain",
$ov.load(URL);
});
});
我有我的部分景色一個完全相同的問題。嘗試在$ ov.load(URL)之前添加警報;並看看是否有效。它爲我做了。我仍然在尋找爲什麼這樣做和/或如何解決它。 – Will