(function(wnd) { function animate() { var frame = this; var current = frame.querySelector("[current]"); if(current) current.removeAttribute('current') if(current && current.previousElementSibling) { current.previousElementSibling.removeAttribute('previous','') } else { frame.lastElementChild.removeAttribute('previous') } if(current && current.nextElementSibling) { current.setAttribute('previous','') current.nextElementSibling.setAttribute('current','') } else { frame.firstElementChild.setAttribute('current','') frame.lastElementChild.setAttribute('previous','') } } function setup() { var frames = document.querySelectorAll('.slider'); for(var i=0;i