aamirafridi / jQuery.Marquee

jQuery plugin to scroll the text like the old traditional marquee
http://aamirafridi.com/jquery/jquery-marquee-plugin
MIT License
961 stars 280 forks source link

animate() doubles duration on first loop #51

Open LanFeusT23 opened 9 years ago

LanFeusT23 commented 9 years ago

When using the duplicated option, the animate function will double the duration of the first loop.

on line 255:

if (o.duplicated) {
    //When duplicated, the first loop will be scroll longer so double the duration
    if (loopCount === 1) {
        o._originalDuration = o.duration;
        if (verticalDir) {
            o.duration = o.direction == 'up' ? o.duration + (containerHeight / ((elHeight) / o.duration)) : o.duration * 2;
        } else {
            o.duration = o.direction == 'left' ? o.duration + (containerWidth / ((elWidth) / o.duration)) : o.duration * 2;
        }
        //Adjust the css3 animation as well
        if (animationCss3Str) {
            animationCss3Str = animationName + ' ' + o.duration / 1000 + 's ' + o.delayBeforeStart / 1000 + 's ' + o.css3easing;
        }
        loopCount++;
    }
    //On 2nd loop things back to normal, normal duration for the rest of animations
    else if (loopCount === 2) {
        o.duration = o._originalDuration;
        //Adjust the css3 animation as well
        if (animationCss3Str) {
            animationName = animationName + '0';
            keyframeString = $.trim(keyframeString) + '0 ';
            animationCss3Str = animationName + ' ' + o.duration / 1000 + 's 0s infinite ' + o.css3easing;
        }
        loopCount++;
    }
}

What is the reason behind that? Could we have an option for this instead?

Thanks,

aamirafridi commented 9 years ago

This is very hard to explain but it work as show in the demo? Which part of these lines you don't understand?