SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Feb 2013
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    current style on one-page menu?

    Hi

    Does anyone know how i can put a current style to a link in my menu even tho its a one page design? otherwise i usually put a class="current" to the correct links in the different files.

    Anyone know how to this? I guess i have to use JS aswell?

  2. #2
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,892
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ReGGaeBOSS View Post
    Does anyone know how i can put a current style to a link in my menu even tho its a one page design? otherwise i usually put a class="current" to the correct links in the different files.

    Anyone know how to this? I guess i have to use JS aswell?
    You've lost me ... if it's only one page, why do you need a menu?

  3. #3
    SitePoint Addict
    Join Date
    Feb 2013
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stevie D View Post
    You've lost me ... if it's only one page, why do you need a menu?
    its one-page but with different sections, with anchors and a scrolleffect. Surerly u have seen onepage designs before?

  4. #4
    Mouse catcher silver trophy Stevie D's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    5,892
    Mentioned
    123 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ReGGaeBOSS View Post
    its one-page but with different sections, with anchors and a scrolleffect. Surerly u have seen onepage designs before?
    Ah, gotcha. Yes, in that case the easiest way would probably be to set an onClick on each of the links that would (a) clear the 'current' style from any other menu link, and (b) apply the 'current' style to that menu link.

    If you're not sure how to do that with Javascript then let me know and we can move this thread over to that part of the forum.

  5. #5
    SitePoint Addict
    Join Date
    Feb 2013
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stevie D View Post
    Ah, gotcha. Yes, in that case the easiest way would probably be to set an onClick on each of the links that would (a) clear the 'current' style from any other menu link, and (b) apply the 'current' style to that menu link.

    If you're not sure how to do that with Javascript then let me know and we can move this thread over to that part of the forum.
    Okey, yeah would be nice if you could move the thread as i don't know how to do that with Javascript=)

    thx

  6. #6
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,997
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by ReGGaeBOSS View Post
    i don't know how to do that with Javascript
    Easiest way would be to use jQuery and a scrolling plugin (such as localScroll).

    Here's an easy to follow tutorial..

    HTH

  7. #7
    SitePoint Addict
    Join Date
    Feb 2013
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Pullo View Post
    Easiest way would be to use jQuery and a scrolling plugin (such as localScroll).

    Here's an easy to follow tutorial..

    HTH
    Thx very much will check it out=)

    EDIT: Maby i was unclear in my topic. I do have the site and the scroll effect already, the thing i want to do is make the menu links display an active/current style different from the other links when on the correct part of the page. Like on this page for example http://wearemotto.com/ .

  8. #8
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,997
    Mentioned
    219 Post(s)
    Tagged
    12 Thread(s)
    Oh, sorry.
    That shouldn't be too hard.
    Can you post a link to your page?

  9. #9
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,658
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Here ya go. You can do this with JS or jquery. Take your pic

    JS http://www.websitecodetutorials.com/...ge-with-js.php

    jQuery http://www.websitecodetutorials.com/...move-class.php


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •