Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11

Thread: Page jumping

  1. #1
    New Coder
    Join Date
    Jun 2013
    Posts
    27
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Page jumping

    I'm not sure if it has to be done with Javascript or with css so forgive me if i posted it in the wrong section,

    basically i'm looking for a page jump ( <span><a href="somearea"> work </a><span> ) like this,
    but it literally "jumps" to that page in no time,
    so here's what i'm looking for: when i click "work" i want it to go to that section fast but i want to see scrolling to it.
    here's an example:
    http://www.wilcore-designs.nl

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,929
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    Yes, it has to be done with JavaScript. Search the internet for “smooth scrolling”.

  • Users who have thanked VIPStephan for this post:

    DesignedbyLau (06-20-2013)

  • #3
    New Coder
    Join Date
    May 2009
    Posts
    45
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Try this. You'll need to watch the scroll bar but instead of acting like a normal anchor tag, it will scroll to the destination. View source code to grab code.

    http://www.codesoaked.com/demo/css-smooth-scroll.html

  • Users who have thanked michaelbt2 for this post:

    DesignedbyLau (06-20-2013)

  • #4
    New Coder
    Join Date
    Jun 2013
    Posts
    27
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thank you guys for the reply,
    i've tried putting it into my script but somehow it doesn't seem to work,
    the example you provide me is it for anchor points?
    or is it only for a certain div id?

    when i googled around i came to this website:http://www.paulund.co.uk/smooth-scro...ks-with-jquery

    it seemed really easy to me but it doesn't work,
    is it legit or am i doing something wrong?

  • #5
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,929
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    You probably also need to read this sticky thread.

  • #6
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by VIPStephan View Post
    You probably also need to read this sticky thread.
    Why do you think this thread belongs in this forum specifically?

  • #7
    New Coder
    Join Date
    Jun 2013
    Posts
    27
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    You probably also need to read this sticky thread.
    But, it's not another script src. so isn't really relevant,

    as in that thread says it's only this in my script and it should work

    $(document).ready(function(){
    $('a[href^="#"]').on('click',function (e) {
    e.preventDefault();
    var target = this.hash,
    $target = $(target);
    $('html, body').stop().animate({
    'scrollTop': $target.offset().top
    }, 900, 'swing', function () {
    window.location.hash = target;
    });
    });
    });

  • #8
    New Coder
    Join Date
    Jun 2013
    Posts
    27
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Never mind it,
    i got it now all working !
    thanks a lot for all you're quick and useful reply's

  • #9
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,929
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    Quote Originally Posted by Logic Ali View Post
    Why do you think this thread belongs in this forum specifically?
    You mean the sticky? Because it’s related to JavaScript frameworks.

  • #10
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Quote Originally Posted by VIPStephan View Post
    You mean the sticky? Because it’s related to JavaScript frameworks.
    No I mean this thread.

  • #11
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,929
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    Because this thread, too, is mainly about jQuery. Originally, I thought I’d leave it in the parent forum but figured that since the OP is using jQuery anyway and most smooth scrolling solutions that come up after a search will be jQuery, this would be the right forum for it.

    Does this answer satisfy you?


  •  

    Posting Permissions

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