Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Feb 2012
    Posts
    4
    Member #
    30798

    Lightbulb Scroll Events, help?

    Is this the right forum for coding help?

    I would appreciate any scripting advice/example code on this.

    I am trying to change the background color of my page while the user is scrolling.
    To be more precise, I want to slowly transition the color of the page depending on the scrollbars position.

    I need to be able to set parameters for the opening color and the closing color.
    To be more precise, I'm saying that I would like my page to be one color when the scrollbar is at the top and another color when the scrollbar is at the bottom. While scrolling up, the color should gradually shift from the bottom color to the top color and while scrolling down the color should gradually shift the opposite way.

    I would like to be able to call an event to happen when the scrollbar is at a certain position. For instance, when the scrollbar is half way down the page, I would like to issue an alert.

    Thank you for your assistance in this matter.

  2.  

  3. #2
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    CSS3 Gradient background

    You want a linear gradient.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  4. #3
    Junior Member
    Join Date
    Feb 2012
    Posts
    4
    Member #
    30798
    Quote Originally Posted by TheGAME1264 View Post
    You want a linear gradient.
    Actually, it's not that simple. I would like to change the pages background color dynamically based on the scrollbar position.

    All I really need to know is how to run a javascript function while the user is scrolling, and when their scrollbar gets to a certain spot on the page.

    Thanks

  5. #4
    Senior Member Webzarus's Avatar
    Join Date
    May 2011
    Location
    South Carolina Coast
    Posts
    3,322
    Member #
    27709
    Liked
    770 times
    What you're asking for cnt be done with simple plug and play scripts ...

    some pretty advanced coding is going to be required and each page will have to have the variable set per page height ... I've seen it done once before, but the code for it was heavy... Imagine math calculations every time a movement of the page happens... And since its client side, each time a page is loaded, the JS has to be downloaded to the visitors browser. Forget about cross browser compatability with this as, most mobile browsers will time out before the script is completely loaded in the browser.

    sometimes the effects we want to accomplish are ahead of what the browers are efficiently capable ( keyword efficiently )...

    perhaps in HTML5 there is something to accomplish this, but I haven't really dug into that enough to know... Not sure if jQuery can or will interact with the math needed to calculate page position vs. scrollbar position ... Etc... And I don't think there is a jquery library for this type of transition... But I may be wrong


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:24 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com