Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Liam Lewis
Liam Lewis
4,432 Points

My jQuery accordion works in Firefox and Chrome, but not Safari

Hiya, I am a student of Web Dev right now and I am building a site with a simple accordion plugin I found. Its nowhere finished yet (i got an issue with the php mailer script too for instance) but right now I just wanna focus on this one issue i got with the accordion. It is here: www.jasminesstoryland.com/fiction.html The accordion is supposed to reveal the story upon clicking the title/picture for that story. And the same thing happens on the other pages containing stories too.

It doesn't work in Safari however it does work fine in Firefox and Chrome.

I get an error message in Safari saying " 'accordion.init' is not a function. (in 'accordion.init("accordion")', 'accordion.init' is undefined)". However I would have thought should that function be undefined - then would not Chrome and Firefox have the same problem?

I know I could perhaps just use a different accordion plugin but I'd like to try to find out if I did something wrong or overlooked.

Please could someone point me in the right direction! :-)

1 Answer

Codin - Codesmite
Codin - Codesmite
8,600 Points

To get it to work in Safari you need to not use "display: none".

If it is set to display: none, Safari will ignore it as if it doesn't exist in your jQuery.

Try using height: 0 instead it is a much more cross browser friendly way to hide content.

Example: http://codepen.io/anon/pen/JGrXXM