Created
March 28, 2014 08:44
-
-
Save baxtheman/9828154 to your computer and use it in GitHub Desktop.
anim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aui:script use="aui-base,anim-base,anim-node-plugin,anim-scroll"> | |
var step = 25; | |
var scrolling = false; | |
var list = A.one('.oneshop-portlet-item-browser .list'); | |
var a = new A.Anim({ | |
node: '.oneshop-portlet-item-browser .list', | |
duration: 0.5 | |
}); | |
A.one('.oneshop-portlet-item-browser .btn.icon-chevron-up').on('mouseenter', function() { | |
scrolling = true; | |
scrollContent("up"); | |
}); | |
A.one('.oneshop-portlet-item-browser .btn.icon-chevron-up').on('mouseleave', function() { | |
a.stop(); | |
scrolling = false; | |
}); | |
A.one('.oneshop-portlet-item-browser .btn.icon-chevron-down').on('mouseenter', function() { | |
scrolling = true; | |
scrollContent("down"); | |
}); | |
A.one('.oneshop-portlet-item-browser .btn.icon-chevron-down').on('mouseleave', function() { | |
a.stop(); | |
scrolling = false; | |
}); | |
function scrollContent(direction) { | |
var amount = (direction === "up" ? -100 : +100); | |
console.log(direction); | |
a.set('to',{ | |
scrollTop: list.attr('scrollTop') + amount | |
}); | |
a.on('end', function() { | |
if (scrolling) { | |
console.log("again"); | |
scrollContent(direction); | |
} | |
}); | |
a.run(); | |
} | |
</aui:script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment