jQuery animation is snappy even with easing
Hi :)
I am trying to fix an animation where it is a scrolling set of divs. After some time, The next div takes the top position at -55px. The code is as follows:
- var landingAlertFeed = 0,
- container = $('.landing-alerts__feed'),
- items = container.find('li'),
- containerHeight = 0,
- numberVisible = 3,
- intervalSec = 3000;
- if(!container.find('li:first').hasClass("first")){
- container.find('li:first').addClass("first");
- }
- items.each(function(){
- if(landingAlertFeed < numberVisible){
- containerHeight = containerHeight + $(this).outerHeight();
- landingAlertFeed++;
- }
- });
- container.css({ height: containerHeight, overflow: "hidden" });
-
- function vertCycle() {
- var firstItem = container.find('li.first').html();
-
- container.append('<li>'+firstItem+'</li>');
- firstItem = '';
- container.find('li.first').animate({ marginTop: "-55px" }, 600, "linear", function(){ $(this).remove(); container.find('li:first').addClass("first"); });
- }
- if(intervalSec < 700){
- intervalSec = 700;
- }
- var init = setInterval("vertCycle()",intervalSec);
- container.hover(function(){
- clearInterval(init);
- }, function(){
- init = setInterval("vertCycle()",intervalSec);
- });
The current easing is at linear but I see no change when I set it to "swing". Am I missing something? Thank you for any help you might be able to provide.