jQuery Snake Carousel Effect -


i can't seem find this, asking see if point me in right direction.

i need products slide around conveyor belt/with snake effect.

view on js fiddle: http://jsfiddle.net/nlgopodt/2/ 

crude diagram of functionality required attached.enter image description here

i going css only, couldn't :nth-child selector work correctly.

anyhow, updated jsfiddle

  • every column in row.
  • every even row floats columns right
  • the javascript prepends columns first row , cascades overflowing columns next row
  • if there no next row, removes overflowing elements.

.container .row:nth-child(even) .col { float: right; }

var $rows = $('.container .row'); setinterval(function(){ var $col = $('<div class="col new">new col</div>'); $rows.eq(0).prepend($col); $col.removeclass('new').addclass('animated bouncein') $rows.each(function(idx, elem){ var $row = $(elem), $cols = $row.children(); if ($cols.length > 4) { var $overflow = $cols.filter(':gt(3)'), $nextrow = $rows.eq(idx + 1); if ($nextrow.length == 0) $overflow.remove(); else $nextrow.prepend($overflow); } }); }, 5000);


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -