tags:

views:

147

answers:

3

Im having some trouble with jQuery's slideToggle function in IE8 for some reason the DIV its opening closes immediately after its opened

heres the code im using

$("h3 a").click(function(){
    id = $(this).attr("href");      
    $(id).slideToggle("slow");
});

and the HTML

<h3><a href="#promo-materials">Graphic and Pormotional Materials</a></h3>
    <div id="promo-materials" class="center gallery">
        <a href="images/portfolio/bistro.png" rel="facebox">
            <img src="images/portfolio/thumbs/bistro.png" alt="" />
        </a>
        <a href="images/portfolio/direct-savings.png" rel="facebox">
            <img src="images/portfolio/thumbs/direct-savings.png" alt="" />
        </a>
     </div>

Here is a link to the functional page it works in all other browsers including IE7

I forgot to post it:

http://bestprintideas.com

I currently have it triggering Compatiblity Mode since I had to get to work today.

A: 

You could try this:

$("h3 a").click(function(){
    id = $(this).attr("href");
    $('#' + id).slideToggle("slow");
});
Sarfraz
The only problem is that i do this for multiple "h3 a" that point to different DIVs
jef2904
@jef2904: see my answer, updated, i think that should do the trick. you were not adding the `#` in your selector.
Sarfraz
@Sarfraz - His `href` has a `#` in it already, it's in the code he posted...and that wouldn't explain why *only* IE8 has the issue.
Nick Craver
A: 

I am betting Nick's comment about it being fired twice is the answer. I copied your code above and it works great for me in IE8.

Chris Love
+1  A: 

Remove this style from the h3 right before the gallery

display: inline-block;

that seems to fix the problem in IE8.

Yisroel
Worked perfectly Thanks
jef2904