Reputation: 13843
Can anyone see any reason why IE8 might not run this jQuery?
$("#slid").toggle(
function() {
$("#Silver").animate({top: "25px"}, 200);
},
function() {
$("#Silver").animate({top: "89px"}, 200);
}
);
It runs the first function but ignores the 2nd top: "89px"
and ideas? Or a better way the same toggle effect can be achieveD?
Upvotes: 0
Views: 132
Reputation: 1162
I've tested it in IE8 and this code works:
CSS
#Silver {top:89px;position:absolute;}
HTML
<div id="slid">click</div>
<div id="Silver">hi</div>
JavaScript
$("#slid").toggle(
function() {
$("#Silver").animate({top: "25px"}, 200);
},
function() {
$("#Silver").animate({top: "89px"}, 200);
}
);
You can have a look at the code here: http://jsfiddle.net/kr6t3/4/
Adding position:absolute
to the element in the CSS works in IE8 and FF3.6.
Upvotes: 1
Reputation: 10353
Had a similar problem with IE and toggle. Can't remember how I solved it. But With IE I've noticed it like class selectors better than id selectors. Try using class instead of ID.
I tried :
$("#slid").toggle(
function() {
$("#Silver").html("hello");
},
function() {
$("#Silver").html("hi");
}
);
seems to be working fine with ie6 don't know about 8.
Upvotes: 0