Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Jquery, scrolling.

Featured Replies

Yes... I am still at this.
in fact I made a restart because I was most likely too busy fixing problems, rather then building the final result.
I made a completely new setup which has only 1 scrolling div. And quite frankly, I am still terrible with jquery.
I editted the jquery which I used for easing the scrolling on the first go.

live: www.thijsch.nl/4people


fiddle: http://jsfiddle.net/Tieskevo/TX8ey/

I tried to change the animate from html, body to the new element that has to move, namely the div #scrolling.
But apparently that would be too easy. Which is great, because it means I get to spend 2 hours of researching different options,
not that it really got me any further..

  $(document).ready(function() {
               $("nav a , #logo a").bind("click",function(event){
                   event.preventDefault();
                   var target = $(this).attr("href");
                   $("html, body").stop().animate({
                       scrollLeft: $(target).offset().left,
                       scrollTop: $(target).offset().top
                   }, 2500);
               });
            });

  $(document).ready(function() {
               $("nav a , #logo a").bind("click",function(event){
                   event.preventDefault();
                   var target = $(this).attr("href");
                   $("#scrolling").stop().animate({
                       scrollLeft: $(target).offset().left,
                       scrollTop: $(target).offset().top
                   }, 2500);
               });
            });

Edited by Tieskevo

try now

 

jsfiddle net / ebqzB / 1 /

 

 

 

 

 

 

        $(function() {    
$('nav a').bind('click.smoothscroll',function (x) {
        x.preventDefault();
        var scroll = this.hash;
        $scroll = $(scroll);
    $('#content').stop().animate({
            'scrollLeft': $scroll.offset().left
        }, 500, 'swing', function () {
            window.location.hash = scroll;
        });
    });
     });
 

 

no need for jquery.smooth-scroll.js

Edited by Guest

  • 2 weeks later...
  • Author

I'm reopening this, because I noticed it has a fatal flaw: it only scrolls correctly from the home "page". id you go from any other page to anything but the home page, it gives varying results.

 

it doesn't move at all then jumps to the right anchor.

it moves back to the homepage first then jumps to the anchor.

 

I have no idea how to solve it. I've been stuck at this for waaaay too long.

Edited by Tieskevo

Take a walk, get some fresh air, clear your head.

When you come back you will discover that you forgot to link to jquery on your sub pages or somthing obvious like that.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.