SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile How-To: Wordpress Particular page Auto Scroll feature to particular id after the page

    First of all - Hi !

    I would like to know how to make an auto scroll based on javascript within the Wordpress but working only on one particular page. In huge shortcut - user clicks on a page and then simply page scrolls to particular id after it loads itself.

    I've created a folder 'Scripts' in wp-content to not make things in mess. Something tells me that there needs to be a file that is a script which I'll place in 'Scripts' folder. After that probably I'll have to ignit that script on that particular page in html view or raw-find the file of that page and edit it to inject the proper reference (for script ignition).

    Probably also I need to mark a part of the page with an element that has an id. It can be a 'div' for example with and id="scroll". Then under script's raw code I'll have to refer to that particular place on page. Like that each view of the page will result in ignition of the script which again will give a result of auto-scroll to that particular div.

    I am not new to html and css but to javascript - yes. Feels like rocket science gosh...

    Any help in creating and implementing such a (theoretically simple) feature would be appreciated.

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,941
    Mentioned
    215 Post(s)
    Tagged
    12 Thread(s)
    Hi there,

    Welcome to the forums

    I use a plugin for this functionality: http://wordpress.org/extend/plugins/...-scroll-links/
    Install it and it does everything you need.

    However, if you want to program something like this yourself, it's quite simple.
    Here's a demo: http://jsfiddle.net/2LuNP/

    Credit goes to @chris.upjohn ;

  3. #3
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi! Thanks for the response . I saw a couple of plugins that are doing such a things but I would prefer to write something by myself and learn thanks to that . I'll check the link !


Tags for this Thread

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
  •