I\'m getting crazy with this IE 7...
==> hhttp://neu.emergent-innovation.com/
Why does following function not work in IE 7, but perfectly with Firefox? Is th
I'm not sure what the problem is exactly... perhaps you can't animate to "display: none
" ? Try this:
toHide.animate({ height : 0 }, 1000, function() { $(this).hide(); });
...thought, it looks like there might be some other issues with the container not having overflow: hidden
set on it.
The best way might be to avoid re-inventing the wheel: the jQuery UI plugin has an accordion built-in. http://docs.jquery.com/UI/Accordion I'm sure the honourable Mr Resig & Co have already dealt with whatever bugs you might be encountering.
After a day of wondering WHY IE won't animate stuff I found that some versions of JQuery no longer do the thing that they used to:
This:
$('#bs1').animate({
"left": bs1x
}, 300, function() {
// Animation complete.
});
will NOT work with this Jquery: https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js
but it DOES work with: https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js
hooray old versions!
As stated by Paul, when using the method. Animate () jQuery IE7 browser does not recognize internally the property 'position'. eg
CSS rule:
li p (bottom:-178px; color: white; background-color: # 4d4d4d; height: 100%; padding: 30px 10px 0 10px;)
Implementation of animation in jQuery:
$('li').hover(function(){
$this = $(this);
var bottom = '-45px'; //valor default para subir.
if( $this.css('height') == '320px' ){bottom = '-115px';}
$this.css('cursor', 'pointer').find('p').stop().find('.first').hide().end().animate({bottom: bottom}, {queue:false, duration:300});
}, function(){
var $this = $(this);
var bottom = '-178px'; //valor default para descer
if( $this.css('height') == '320px' ){bottom = '-432px';}
$this.find('p').stop().animate({***position: 'absolute'***, bottom:bottom}, {queue:false, duration:300}).find('.first').show();
});//fim do hover()
What to work in all browsers:
CSS rule:
li p (position: absolute; left: 0; bottom:-178px; color: white; background-color: # 4d4d4d; height: 100%; padding: 30px 10px 0 10px;)
JQuery code:
$('li').hover(function(){
$this = $(this);
var bottom = '-45px'; //valor default para subir.
if( $this.css('height') == '320px' ){bottom = '-115px';}
$this.css('cursor', 'pointer').find('p').stop().find('.first').hide().end().animate({bottom: bottom}, {queue:false, duration:300});
}, function(){
var $this = $(this);
var bottom = '-178px'; //valor default para descer
if( $this.css('height') == '320px' ){bottom = '-432px';}
$this.find('p').stop().animate({bottom:bottom}, {queue:false, duration:300}).find('.first').show();
});//fim do hover()
In my case it was resolved this way.
You could make use of the jQuery selector :visible rather than toggling the isVisible class.
Also your animation seems functionally the same as slideUp(1000).
I came across a similar problem with the animate function and was surprised when it was showing the error coming from the core jQuery library. However jQuery is fine, its IE you need to cater for.
When animating any attribute of an element in IE, you need to make sure that in your CSS there is a starting point for the attribute you are going to alter. This also applies to Safari.
As an example, moving a div continually to the left,
JQuery:
var re = /px/;
var currentLeft = $("#mydiv").css('left').replace(re,'') - 0;
$("#mydiv").css('left',(currentLeft-20)+'px');
CSS:
#mydiv { position: absolute; top: 0; left: 0; }
If you DO NOT put in a left & top starting position IE will eventually throw an error.
Hope this helps
I had a problem recently where animate() wasn't working as expected and it was down to IE rendering my css padding: properties differently to FireFox.
This seemed to have happened to other people, and I had to hack around in my css; using margins and fixed widths and other such horrible IE hacks, instead.