jquery脚本可在除IE8以外的所有浏览器中工作
我有一个jquery脚本,它在除IE之外的所有浏览器中都能很好地工作。它的一部分在IE中工作,但主要部分不能,我不知道为什么jquery脚本可在除IE8以外的所有浏览器中工作,jquery,internet-explorer,Jquery,Internet Explorer,我有一个jquery脚本,它在除IE之外的所有浏览器中都能很好地工作。它的一部分在IE中工作,但主要部分不能,我不知道为什么 $(document).ready(function() { $(".close").hover( function() { $(this).css({ opacity: "0.4" }); }, function() { $(this).css({ opacity: "0.2" }); }); $(".nam
$(document).ready(function() {
$(".close").hover(
function() {
$(this).css({
opacity: "0.4"
});
}, function() {
$(this).css({
opacity: "0.2"
});
});
$(".name").hover(
function() {
$(this).css({
color: "#ED6736"
});
}, function() {
$(this).css({
color: "#292929"
});
});
$("#wrapper_MAIN_INPT").css({
'height': $("#practice_staff_MAIN_INPT").innerHeight()
});
$("#STAFF_HEADER_MAIN_INPT").css({
'marginTop': $("#practice_staff_MAIN_INPT").innerHeight()
});
$("#BIO_MAIN_INPT").css({
'marginTop': $("#practice_staff_MAIN_INPT").height()
});
$("#EDU_MAIN_INPT").css({
'marginTop': $("#practice_staff_MAIN_INPT").height()
});
$("#CONTACT_MAIN_INPT").css({
'marginTop': $("#practice_staff_MAIN_INPT").height()
});
var a1, a2, a3; //Establish Loading Variables
$(".name_MAIN_INPT").on('click' , function() {
MAIN_OUTPT_close();
close_850();
FOX_close();
SPEECH_close();
a1=0; //Reset the Loading Variables
a2=0;
a3=0;
var id = $(this).attr('id');
$('#photo_MAIN_INPT').empty();
$("<img>", { src: id + ".jpg" }).prependTo("#photo_MAIN_INPT");
$("#therapist_MAIN_INPT").load(id +"_name.txt");
$("#credentials_MAIN_INPT").load(id +"_credentials.txt");
$("#bio_MAIN_INPT_text").load(id +"_bio.txt", function() {
$("#bio_MAIN_INPT_img").css({
'marginTop': ($("#bio_MAIN_INPT_text").innerHeight() /2) -
($("#bio_MAIN_INPT_img").height() / 2)
});
console.log('Loaded'); //Testing Purposes Only
a1=1; // Loaded
animate_MAIN_INPT(); // Attempt Animation
});
$("#edu_MAIN_INPT_text").load(id +"_edu.txt", function() {
$("#edu_MAIN_INPT_img").css({
'marginTop': ($("#edu_MAIN_INPT_text").innerHeight() /2) -
($("#edu_MAIN_INPT_img").height() / 2)
});
console.log('Loaded'); //Testing Purposes Only
a2=1; // Loaded
animate_MAIN_INPT(); // Attempt Animation
});
$("#contact_MAIN_INPT_text").load(id +"_contact.txt", function() {
$("#contact_MAIN_INPT_img").css({
'marginTop': ($("#contact_MAIN_INPT_text").innerHeight() /2) -
($("#contact_MAIN_INPT_img").height() / 2)
});
console.log('Loaded'); //Testing Purposes Only
a3=1; // Loaded
animate_MAIN_INPT(); // Attempt Animation
});
});
function animate_MAIN_INPT() {
if((a1===1) && (a2===1) && (a3===1)){ //Animate if all thre divs are loaded
$("#wrapper_MAIN_INPT").animate({
'height': 87 + $("#BIO_MAIN_INPT").outerHeight() + $("#EDU_MAIN_INPT").outerHeight()
+ $("#CONTACT_MAIN_INPT").outerHeight()
}, 300);
$("#practice_staff_MAIN_INPT").animate({
'margin-top': $("#practice_staff_MAIN_INPT").innerHeight() * -1
}, 300);
$("#STAFF_HEADER_MAIN_INPT").delay(160).animate({
'marginTop': 15
}, 300);
$("#BIO_MAIN_INPT").delay(330).animate({
'marginTop': 0
}, 450);
$("#EDU_MAIN_INPT").delay(450).animate({
'marginTop': 0
}, 450);
$("#CONTACT_MAIN_INPT").delay(570).animate({
'marginTop': 0
}, 450);
}
}
function MAIN_INPT_close() {
$("#wrapper_MAIN_INPT").animate({
'height': $("#practice_staff_MAIN_INPT").innerHeight()
}, 300);
$("#practice_staff_MAIN_INPT").animate({
'margin-top':0
}, 300);
$("#STAFF_HEADER_MAIN_INPT").animate({
'marginTop': $("#practice_staff_MAIN_INPT").innerHeight()
}, 300, function () {
$("#STAFF_HEADER_MAIN_INPT").css({
'marginTop': $("#practice_staff_MAIN_INPT").innerHeight()
});
$("#BIO_MAIN_INPT").css({
'marginTop': $("#practice_staff_MAIN_INPT").height()
});
$("#EDU_MAIN_INPT").css({
'marginTop': $("#practice_staff_MAIN_INPT").height()
});
$("#CONTACT_MAIN_INPT").css({
'marginTop': $("#practice_staff_MAIN_INPT").height()
});
});
}
$("#close_MAIN_INPT").click(function() {
MAIN_INPT_close();
});
});
$(文档).ready(函数(){
$(“.close”)。悬停(
函数(){
$(this.css)({
不透明度:“0.4”
});
},函数(){
$(this.css)({
不透明度:“0.2”
});
});
$(“.name”).hover(
函数(){
$(this.css)({
颜色:“ED6736”
});
},函数(){
$(this.css)({
颜色:“292929”
});
});
$(“#包装器_主_输入”).css({
高度:$(“#实践#人员(主要)输入”)。内部高度()
});
$(“#STAFF_HEADER_MAIN_INPT”).css({
‘marginTop’:$(“#实践#人员(主要)输入”)。内部高度()
});
$(“#BIO_MAIN_INPT”).css({
‘marginTop’:$(实习员工主要输入)。身高()
});
$(“#教育主输入”).css({
‘marginTop’:$(实习员工主要输入)。身高()
});
$(“#联系_MAIN_INPT”).css({
‘marginTop’:$(实习员工主要输入)。身高()
});
变量a1、a2、a3;//建立加载变量
$(“.name\u MAIN\u INPT”)。在('click',function(){
主输出关闭();
关闭850();
FOX_close();
讲话(结束);
a1=0;//重置加载变量
a2=0;
a3=0;
var id=$(this.attr('id');
$('#photo_MAIN_INPT').empty();
$("
这里是指向完整页面的链接。当你滚动这些链接时,它们的名称会变成橙色,你可以看到它们在Firefox、Chrome、Safari中工作,但在IE中再次出现问题。任何帮助都会很好,谢谢。运行JavaScript。我怀疑你会发现你的问题。删除console.log()
,IE无法处理此问题。
这就解释了为什么您的一些脚本可以工作,而其他脚本不能工作。IE在console.log()上失败并中断
什么部分不起作用?我们真的需要所有这些代码吗?我实际上做得更少了,动画不是在单击时发生的,但滚动效果很好。我不确定到底是什么不起作用。看起来你正在尝试在加载完元素之前设置元素的动画,它只是出现而不是为你设置动画吗?(我无法访问您的站点)嗯,这就是变量的用途,我认为加载应该是好的?太好了!我有一种感觉,有人会很快就把它挑出来,非常感谢。