Jump to content

ie7 compatibility


White_Lily

Recommended Posts

Hey,

 

I have chosen to have the menu on a CMS im building have an accordion effect.

 

I have it working in all browsers except IE7, now I know this browser is fairly old, but since a lot of people still use it fairly regularly my company has made it mandatory to make sure it functions correctly in IE7 to.

 

Here is the jQuery:

 

$(function(){
	$(".accordionButton").on("click", function(){
		if($(this).next().is(":hidden") == true){
			$(".accordionContent").slideUp("slow");
			$(this).next().slideDown("slow");
		}else if($(this).next().is(":hidden") == false)
			$(".accordionContent").slideUp("slow");
	});
});

 

I found out the .on("click") part works, it's when it comes to the conditions that it then decides to do nothing.

 

Any ideas?

 

- Lily

 

P.S: I have look on google for function compatibility issues regarding next() and is() and cant seem to find any on these. SlideUp/Down() I know work since I have used them in the past for banners and other client requirements.

Edited by Maq
Changed slideDown to slideUp under else if
Link to comment
Share on other sites

Hey, tried it and its skipping the initial if statement completely and going straight to the elseif.

 

This is only happening in ie7.

 

$(".accordionButton").click(function(){
console.log("BUtton Clicked");
if($(this).next().is(":hidden") == true){
$(".accordionContent").slideUp("slow", function(){
console.log("Slide Up 1");
});
$(this).next().slideDown("slow", function(){
console.log("Slide Down");
});
}else if($(this).next().is(":hidden") == false){
$(".accordionContent").slideUp("slow", function(){
console.log("Slide Up 2");
});
}
});
Edited by White_Lily
Link to comment
Share on other sites

Firstly, try removing the equality operator. That's how the jQuery documentation shows it.  (I also removed the eslif condition because it's the exact opposite of the if, so it is superfluous):

 

 

$(function(){
    $(".accordionButton").on("click", function(){
        if($(this).next().is(":hidden")){
            $(".accordionContent").slideUp("slow");
            $(this).next().slideDown("slow");
        }else
           $(".accordionContent").slideUp("slow");
    });
});

 

 

If that doesn't work, try giving some of the answers on this link a try:

 

http://stackoverflow.com/questions/178325/testing-if-something-is-hidden-with-jquery

 

Also, what version of jQuery are you using? 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.