Results 1 to 3 of 3

Thread: Slick Custom Scrollbar | How to jump automatically to defined paragraph?

  1. #1
    Join Date
    Jul 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Slick Custom Scrollbar | How to jump automatically to defined paragraph?

    Slick Custom Scrollbar script v1.1
    http://www.dynamicdrive.com/dynamicindex11/scrollc.htm

    Thanks for this wonderful script.

    But I have Question: How is it possible to jump onload (instead of clicking a link) to a paragraph?

    Thanks a lot for massive Feedback.

    lucioperca

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You can do it in the normal manner by making a link - say:

    Code:
    <a href="#" rel="paragraph-B" parent="scrollcontent1" onClick="return false">Go to Paragraph B within Demo #1</a>
    If you like you can hide it:

    Code:
    <a style="display: none;" href="#" rel="paragraph-B" parent="scrollcontent1" onClick="return false">Go to Paragraph B within Demo #1</a>
    Then here in the head of the page, in the init, add the highlighted:

    Code:
        $( document ).ready( function() {
            $( "div[rel='scrollcontent1']" ).customscroll( { direction: "vertical" } );
            $( "div[rel='scrollcontent2']" ).customscroll( { direction: "horizontal", bounce:0 } );
    	$('[rel=paragraph-B]').trigger('click');
        });
    Or if you want to activate a given paragraph via a link from another page. Say the page with scroller on it is scroller.htm - then keep the on page link, hidden or shown, use this as the init:

    Code:
        $( document ).ready( function() {
            $( "div[rel='scrollcontent1']" ).customscroll( { direction: "vertical" } );
            $( "div[rel='scrollcontent2']" ).customscroll( { direction: "horizontal", bounce:0 } );
            var m = /[?&;]rel=([^&;#]*)/.exec(location.search);
            m? $('[rel=' + unescape(m[1]) + ']').trigger('click') : null;
        });
    And the link on the other page would be:

    Code:
    <a href="scroller.htm?rel=paragraph-B">Go to B on the Scroller Page</a>
    Last edited by jscheuer1; 07-01-2012 at 09:58 AM. Reason: add additional mehod
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That works fantastic!

    Thanks a lot for this really fast solution!

    lucioperca

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
  •