[英]jQuery modal window not working in internet explorer
我有一個舊的網站,該網站已被兩個網站取代,並開始制作一個模式窗口,以引導人們訪問正確的網站。
我只能在舊站點上提供HTML文件,並且HTML的結構不是很統一。 我決定在文檔的開頭添加一些jQuery,從而在頁面上添加一個模式窗口,使人們可以鏈接到新站點。
這一切在Linux,Linux和Mac上的Chrome,Safari和Firefox上都可以正常運行,但是在PC上的Internet Explorer上進行測試時,它看起來完全錯誤,並且根本無法正常工作。 我打開了控制台,沒有任何錯誤。
$(function(){
var disappear = function(){
// window.location = window.location
var $m = $('.modal')
$m.eq(0).fadeOut()
$m.hide('slow')
}
$('body').append(
$("<div class='modal'>").css({
position: 'fixed',
width: '100%',
height: '100%',
backgroundColor: '#000',
opacity: .8,
top: 0,
left: 0
})).click(disappear).after($("<div class='modal'>").css({
position: 'fixed',
width: 600,
// height: 300,
backgroundColor: '#FFE',
borderRadius: 10,
border: "5px solid #005400",
top: '10%',
left: '50%',
marginLeft: -300,
padding: '1em',
fontFamily: 'trebuchet ms, sans-serif'
}).html("<h2>Please be advised</h2><p>\
The information on this website is maintained for historical purposes.<br>\
It has not been updated since 2009.<br>\
However, Tesfa Community Tourism continues to thrive.<br>\
<h3>For up to date information...</h3>\
<a href='http://tesfatours.com/?from=cbtcom' class='button green'>Book with Tesfa Tours</a>\
<a href='http://community-tourism-ethiopia.org/?from=cbtcom' class='button sand'>Community website</a>\
<a href='#' id='close' class='button'>Continue to archive site</a>\
</p>\
"))
$('#close').css({fontSize:'12px'}).live('click',disappear);
$('table table').eq(1).html(myString)
})
關於為什么失敗的任何想法都值得贊賞。
嘗試在CSS中使用它,然后讓我知道-
filter:alpha(opacity=80);
opacity: 0.8;
當您忘記諸如逗號(,)
或分號(;)
或花括號({ })
類的小字符時,這通常在IE中發生。 無論您用上面的代碼寫過什么,我都檢查過這是正確的,但是在其他情況下,您必須檢查所有功能。
我也遇到過這類問題,我在一個函數中錯過了。 在我看來,讓我們進行如下檢查:
$('#close').css({fontSize:'12px'}).live('click',disappear);
$('table table').eq(1).html(myString)
});
我最后加了一個分號。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.