我有一个旧网站,它已被两个网站取代,并开始制作一个模式窗口,以指导人们访问正确的网站。jQuery模式窗口不能在Internet Explorer中工作
我只能在旧网站上提供HTML文件,并且HTML的结构不是很统一。我决定在文档的头部添加一些jQuery,它为页面添加了一个模式窗口,为人们提供了到新网站的链接。
这一切都适用于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)
})
任何想法,为什么这种失败赞赏。
这可能是正确的 - 但是我现有的页面继承了太多糟糕的代码 - 将内容复制出来并从头开始会更容易 - 所以我绝对不会知道。 –