我在我的网站的许多地方使用了以下代码
function display_modal_window_screen(url, height, width_param) {
var is_update = 0;
if (height == null || height == '') {
height = 600;
}
width = 816;
if (width_param) {
width = width_param;
}
item = site_url + url;
jQuery(".iframe").fancybox({
type: 'iframe',
width: width,
href: item,
//fitToView: false,
beforeShow: function() {
var file_url = $('.fancybox-iframe').attr('src').split(site_url);
var file_arr = file_url[1].split('?');
var window_height = $('.fancybox-iframe').contents().find('html').height();
var screen_height = $(window).height();
if (window_height > 445 && window_height > 471 && window_height > 559 && window_height > 664) {
this.minHeight = screen_height - 80;
} else {
this.minHeight = $('.fancybox-iframe').contents().find('html').height();
}
},
onUpdate: function() {
var file_url = $('.fancybox-iframe').attr('src').split(site_url);
var file_arr = file_url[1].split('?');
var window_height = $('.fancybox-iframe').contents().find('html').height();
var screen_height = $(window).height();
if (file_arr[0] == 'item_pre_screening.php' && sign_flag == false) {
this.maxHeight = screen_height - 80;
//$.fancybox.update();
sign_flag = true;
}
if (file_arr[0] == 'sign_in.php' && (sign_flag == false || ($('.fancybox-iframe').contents().find('#member_type_container').is(':visible') == true && is_update == 0))) {
var window_height = $('.fancybox-iframe').contents().find('html').height();
if (window_height > screen_height) {
this.minHeight = screen_height - 70;
} else {
this.minHeight = $('.fancybox-iframe').contents().find('html').height();
}
sign_flag = true;
if ($('.fancybox-iframe').contents().find('#member_type_container').is(':visible') == true) {
is_update = 1;
}
$.fancybox.update();
}
}
});
}
然后我使用这个HTML代码
<a class="iframe" onclick="display_modal_window_screen('item_pre_screening.php?window=modal', 606,800);" href="<?php echo $site_url; ?>item_pre_screening.php">Item Pre-Screening</a>
我已经将这个html格式用于我需要在锚标签上打开fancybox的所有地方。它在FF,Chrome和Safari中运行良好,但它在IE中无效。
请帮帮我!