Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marquee Speed Suggestion/Feature #1

Closed
knowj opened this issue Feb 4, 2013 · 11 comments
Closed

Marquee Speed Suggestion/Feature #1

knowj opened this issue Feb 4, 2013 · 11 comments

Comments

@knowj
Copy link

knowj commented Feb 4, 2013

Feature request:
Currently the speed is based on the milliseconds which is great if you are working with a static width (It takes 10,000ms to move 800px). However as the content area expands the speed of the marquee increases to potentially un-manageable/un-readable speed.

Suggestion:
Calculate the speed based on distance/time. It would probably be worth having an option to add a parent container that would be taken into account in the speed calculation.

`

  • item 1
  • item 2
  • item 3
  • `

    This approach would mean that the scroll speed would be consistent whether the scrolling content is 500px or 5000px.

    @Fishdrowned
    Copy link

    I suggest that rename "speed" to "duration" which means how long it takes to move a pixel from start point to end point

    @knowj
    Copy link
    Author

    knowj commented Feb 5, 2013

    I've done some maths and if you divide the content width by the parent width and use the result as a modifier for the speed/duration (o.speed*speedAdjustment) you will get a result for the amount of time it takes for the visible content to scroll from left to right. I.E If the parent container is 300px and the speed/duration is set to 10s/10,000ms it will take 10s for 300px of content to pass through the visible window.

    Example code (Add in after line 33 where elWidth is set):
    if (parentWidth = $this.parent().width()){
    ##if (elWidth>parentWidth){
    ####var speedAdjustment = elWidth/parentWidth;
    ####o.speed = o.speed * speedAdjustment;
    ##}
    }

    Hopefully this makes sense. If I get time this week I'll work out a more suitable implementation and put in a pull request.

    @aamirafridi
    Copy link
    Owner

    That would be great. Thats totally makes sense.

    @aamirafridi
    Copy link
    Owner

    Any better? 6535215

    @fredgalvao
    Copy link

    I'm trying to set up a marquee that has the same animation speed regardless of content size or text length (I'll consider the currently available speed option as the duration, as it should be renamed imho).

    After 6535215 , the animation duration is always adjusted according to the elWidth|elHeight, supposedly.

    However, as I went ahead and implemented an adjustSpeed boolean option to opt out of the adjustment, I realized that adjustmet was already being done before the formula used now (see https://github.com/aamirafridi/jQuery.Marquee/blob/master/jquery.marquee.js#L83). What makes it adjust duration without it is that the increment used is the elWidth/elHeight in the case {o.duplicated: true, o.direction: 'left'} (my case), and this itself is already dependant on content size + gap.

    Does somebody know how I can achieve a constant animation speed regardless of content size?

    @aamirafridi
    Copy link
    Owner

    Not sure what exactly you are asking but currently the speed you defined will remain constant regardless of the content size. Check this http://jsfiddle.net/aamir/jc7F3/48/

    @fredgalvao
    Copy link

    Well, I'm surprised now because I've tested a lot of combinations and went through the whole code, never to see that behaviour.
    I don't have a test case to prove otherwise, so thank you very much for your time!

    @sachinverma1811
    Copy link

    Hi everyone,
    I know this conversation are to old but i need your help.
    I just used this plugin in my website. Everything is working perfectly.
    I have a requirements to control the scrolling speed (increase or decrease) on users clicks on faster/slower buttons.

    Can anyone help me to achieve this.???

    @GiorgosK
    Copy link

    GiorgosK commented Dec 14, 2018

    opening new issue

    @aamirafridi
    Copy link
    Owner

    aamirafridi commented Dec 14, 2018 via email

    @GiorgosK
    Copy link

    GiorgosK commented Dec 14, 2018

    @aamirafridi it seems the speed is still not the same

    This issue was closed.
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    6 participants