简体   繁体   中英

Just can't get the image slider go horizontal

I'm just an nooby with JS, I did a lot of research for letting the image-slider slide horizontal. But it never worked. Here's an link to the JsFiddle .

This is the JS code:

$(function(){
    $('#slider li').hide().filter(':first').show();
    setInterval(slideshow, 3000);
});


function slideshow() {
    $('#slider li:first').slideToggle('slow').next().slideToggle('slow').end().appendTo('#slider');
}

试试这个小提琴: http : //jsfiddle.net/blocknotes/e13wuo6d/13/

$('#slider li:first').animate({width: 'toggle'}).next().animate({width: 'toggle'}).end().appendTo('#slider');

you make effect like this with using .toggle('slide') instead of slideToggle()

function slideshow() {
    $('#slider li:first').toggle('slide').next().toggle('slide').end().appendTo('#slider');
}

Demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM