Grow your CSS skills. Land your dream job.

Question Regarding jQuery ScrollTo and Link/href Targets

  • # April 21, 2010 at 7:03 pm

    I’m currently working on a personal site which makes use of jQuery ScrollTo. It’s a one page site with a few sections, and I’m using the ScrollTo to move the window to each section. I’ve got it all working fine, but I had a question regarding the links. The way the links are currently setup are like this:

    Code:

    What seems to be the downside is that when you click a link, you see a split second flash of the section it’s about to bring you to. Sometimes it doesn’t happen, or is barely noticeable, but it’s still unpleasant, and not optimal.

    I know I could put ‘javascript:void(0);’ for the href of each link, but doesn’t that kinda kill accessibility, considering the links won’t do anything for people who don’t have JavaScript enabled? The other thing I prefer about the way I have it now, is that when you click a link, the URL in the browser is updated to that section, so a user could bookmark or link to a specific section if they wanted.

    Does anyone know have the best of both worlds, or does it have to be a choice between proper links or a slightly nicer viewing experience?

    Thanks in advance for any help. I appreciate it. :)

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".