jquery - Slide menu with javascript -
i'm trying create new menu job listings wordpress page, 1 on page: http://www.resume.se/, says senaste jobben (sorry being in swedish, hope menu i'm referring to). so, want list object visible few seconds, , want menu slide left, first time width of first list object, second slide width of second list object, , on.
if ($('.container-menu-platsannonser').length > 0 ) { var slider = $('.menu-platsannonser').children('ul'); speed = 4000; slider.each(function(){ var $this = $(this); var li = $this.find('li'); var no_of = li.length; var cur = 1; if (3 < no_of) { $this.slideshow = function() { ++cur; $this.animate({ 'margin-left': '-='+100 }, 600, 'swing', function(){ if (no_of == cur) { $this.css('margin-left', '0'); cur = 1; } settimeout($this.slideshow, speed); }) } settimeout($this.slideshow, speed); } }) }
i've managed set slide 100 px, how animation width change each list item? also, right have 4 menu items, created wordpress. code makes list items slide 2 , half time, , starts beginning. menu loop seamlessly. bear me on this, since kinda suck @ javascript. please, let me know if i'm being unclear, or if need additional information. so, sum up. i'd is:
– slide menu left, width of list object
– keep on looping endlessly
appreciate can get!
to width on list item think can use:
$("li:fist").outerwidth(true);
to keep loop going forever wait animation complete , move li end of list.
var $li = $("li:first"); $li.parent().append($li);
Comments
Post a Comment