Streaming live at 10am (PST)

Slider Order Start At

Hi, everybody,
I’m developing this site and I need to get the slider started from Slide number two, and I’ve done it without problems with this Javascript:

But now I need the slider to start on slide number one from mobile.
How do I optimize the code?
Is it possible to do that?

@ginka_studio

Hey Luca,

You could something like;

$(document).ready(function() {
    $('#plan div:nth-child(2)').trigger('tap');

    $(window).resize(function() {
       if( $(this).width() <= 479 ) {
          $('#plan div:nth-child(1)').trigger('tap');
       }
    })
});

If you want this to respond to live media queries (as user actively changes the browser window width) do this instead;

$(document).ready(function() {
    $(window).resize(function() {
       if( $(this).width() <= 479 ) {
          $('#plan div:nth-child(1)').trigger('tap');
       } else {
          $('#plan div:nth-child(2)').trigger('tap');
       }
    })
});
1 Like