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
    Senior Member RDesignista's Avatar
    Join Date
    Feb 2012
    Location
    Coconut Tree City
    Posts
    822
    Member #
    30921
    Liked
    123 times
    Hi,

    I am trying to blend two menu scripts together on my personal redesign project to create one of those cool 1-page websites you see here and there.

    One of the scripts is a smooth scroller from CSS Tricks. It allows you to have the screen scroll to anchored links/internal links, rather than simply jumping to them.

    The second script is a sticky menu. It has a is position:static at first, but as you scroll down past it, it sticks to the top of your screen (position: fixed).

    I am able to put them together with decent results. I had jerking issues before, but fixed them and it works fine responsively or with IE8. However, it seems that in Google Chrome, the anchors don't seem to calculate properly - the screen will scroll (but not to the correct position) and then it will automatically jerk to the anchor.

    Anyone have any ideas? Or anyone know an all-in-one script I can look to? I am somewhat okay with javascript/Jquery, but the functions are not at all familiar to me.

    -R

  2.  

  3. #2
    Senior Member RDesignista's Avatar
    Join Date
    Feb 2012
    Location
    Coconut Tree City
    Posts
    822
    Member #
    30921
    Liked
    123 times
    Wow... my message has been up 5 days. No response and no one else has posted anything in this thread. I guess no one has Javascript problems anymore? Haha.

    Anyway, I ended up looking for another smooth-scroll script and found a great one by Trevor Davis. His script also includes a "current" class, a class which will automatically adjust to the section you are scrolling on. Best of all, it does not have seem to have any height calculation bugs, which was so prevalent with the CSS Tricks one. Works fine with my sticky menu and is actually smoother than the CSS Tricks one. WIN all around.

    -R

  4. #3
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    I really like it though, it looks great! It's a bit jerky at the top...

  5. #4
    Senior Member RDesignista's Avatar
    Join Date
    Feb 2012
    Location
    Coconut Tree City
    Posts
    822
    Member #
    30921
    Liked
    123 times
    Quote Originally Posted by shovenose, post: 241899
    I really like it though, it looks great! It's a bit jerky at the top...
    Thanks. I am trying to make it look good.

    After doing more reading, I realize that Chrome is so progressive that it loads DOM stuff too quickly and causes mis-calculations (don't really know what that means, but that's what I read ). To solve this, the initializing script needs to change from:

    $(document).ready(function()

    to

    $(window).load(function()

    ... and Chrome works!

    -R


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
  •  

Search tags for this page

java menu smooth scrolling to anchor with fixed menu

Click on a term to search for related topics.
All times are GMT -6. The time now is 05:17 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com