Text 20 Mar 5 notes Sliding elements with IE6

If you want to slide down some element with jquery you can do it in different ways. But if you want to goal an exactly behavior in all browsers you should forget to use .animate function and change opacity. Everybody knows that IE6 isn’t the best browser driving opacities… For example, you get this:

if($('.new_password').css("display") == "none"){  
  $('.new_password').animate({
		opacity: 1,
		height: 'toggle'
	}, 500, 'swing',function(){
	  $('#modify_passwd').text('discard');
	  $('#newpasswd').focus();
	});

}else {
  
  $('.new_password').animate({
		opacity: 0,
		height: 'toggle'
	}, 500, 'swing'  ,function(){
 		  $('#modify_passwd').text('modify');
 		});
  
}
Well, if you try the following you’ll get a perfect action:
 $('#modify_passwd').click(function(ev){
      
      if($('.new_password').css("display") == "none"){  
        $('.new_password').slideDown('slow', function() {
            $('.new_password').css('opacity','1');
            $('.new_password').children('div.field').css('opacity','1');
            $('.new_password').children('div.field').children('span').css('opacity','1');
            $('#modify_passwd').text('discard');
            $('#newpasswd').focus();
            
          });
      }else {
        $('.new_password').css('opacity','0');
        $('.new_password').children('div.field').css('opacity','0');
        $('.new_password').children('div.field').children('span').css('opacity','0');
        
        $('.new_password').slideUp('slow', function() {
            $('#modify_passwd').text('modify');
          });
        
      }});

  1. rabarroso posted this

Design crafted by Prashanth Kamalakanthan. Powered by Tumblr.