The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Slideshow not working in toggle tabs

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #42154

    Hi guys,

    Please take a look at a site I’m developing, you will see I am making use of the slideshow plugin flexslider. You will also see that the site has multiple tabs. If you look at the news section you will see the articles each have a slideshow, these work fine when the tab is open by default, but if the article tab is closed by default and then opened, then the slideshow images are all small and not working correctly. Any help?

    Many thanks,

    Chris Coyier

    What you might want to try is to wait to initialize the slider until after the window is loaded. It looks like the widths of the list items in the slider are programmatically calculated. That calculation could be wrong if the image isn’t done loading yet. So it’s best to wait until it is loaded.

    $(window).load(function() {
    // load slider here

    Or, make sure all those images have proper width/height attributes on them so the slider list items can be calculated correctly right away.


    The problem is it’s a responsive layout, so there is no fixed width on the images only max-width: 100%


    Hey Aaron,

    when i checked your website, you seemed to have removed the slider. so can’t really pinpoint the problem.

    but what i think is happening is, when the tabs are hidden, the images inside it don’t get loaded

    so the image widths wouldn’t be calculated on windows load and hence the slide show doesn’t work

    but when the tab is open, the images would be loaded on windows load.

    what i would suggest is you can initialize the slide show once the tab is opened or use a script which checks if all the images inside the dom are loaded before firing a callback.

    i’ve made one for my personal site, you can use that if it fits your bill,


    Hey Aaron,

    Your problem might be the fact your using max-width: 100%.
    I have only had problems declaring max-width: 100%. Instead try doing something like this.

    .class {
    max-width: 960px; /** Put in whatever is the largest width it wil ever need to be **/
    width: 100%;

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.