Daniel Daniel - 3 months ago 10
HTML Question

jquery auto slider is not working as intended

I am using a jQuery slider that I have used on a previous project.The problem is that the slider won't work now..The images just go on under another and nothing happens.I also made sure I have included the jQuery link in the index.Here is a jsfiddle link to the code, since it is too big to be uploaded here: jsfiddle.net/1y7gyuvw/ .

Answer

Your code is fine just two changes need to be done. 1. you need to include jquery file what you didn't include. 2. You have just specified all code stuff about your slider, but you didn't call the function to create the slider so just call that.

like following. I have created jsfiddle for you. http://jsfiddle.net/ej5q80wh/
Enjoy it. :)

$( '.sldr' ).each( function() {
    var th = $( this );
    th.sldr({
        focalClass    : 'focalPoint',
        offset        : th.width() / 2,
        sldrWidth     : 'responsive',
        nextSlide     : th.nextAll( '.sldr-nav.next:first' ),
        previousSlide : th.nextAll( '.sldr-nav.prev:first' ),
        selectors     : th.nextAll( '.selectors:first' ).find( 'li' ),
        toggle        : th.nextAll( '.captions:first' ).find( 'div' ),
        sldrAuto      : true,
        sldrTime      : 2000,
        hasChange     : true
    });
});

you are to just give the right path for your image and image will be started to slide. If you have any problem then let me know, and I will decimate that problem for you.

Comments