News for hackers. Stuff that matters.
Re:Qualities that I believe make the most difference in prog... by cabalamat on Tuesday February 28, 2017 @09:10AM (#13753834)
> we use a javascript scrolling library, for reasons etc, long story short a programmer spent a couple day trying to figure out why the horizontal bar wronly showed on edge, until I went in and dropped a display none on the bar itself.

Wouldn't an even simpler solution be to just use the scrolling built into browsers?

Re:Qualities that I believe make the most difference in prog... by avereveard on Tuesday February 28, 2017 @01:02PM (#13755907)
Because while default scroll is fine for scrolling pages whole, in any scrollable div that's not top level it looks out of place like a blacksmith on an iceberg.

It's a gray slab that looks like a tombstone riding a straight, dull rollercoaster and unless your site makes a point of having a '90s inspirational look there's no way to integrate them in a page so that it doesn't feel completely detached.

Re:Qualities that I believe make the most difference in prog... by lacampbell on Tuesday February 28, 2017 @08:06PM (#13760001)
If I was in your team I would be saying "why not just scrap scrollable divs?".

I am always looking for excuses to get rid of stuff.

Re:Qualities that I believe make the most difference in prog... by victormustar on Tuesday February 28, 2017 @09:15AM (#13753858)
I'll do r&d for 1 or 2 days and give you the right answer :)
Re:Qualities that I believe make the most difference in prog... by unoti on Tuesday February 28, 2017 @11:34AM (#13754952)
If you need smooth scroll you can't rely on browser support and need to use a library or cook something up yourself. It's surprising how few browsers work with smooth scroll. Today it's basically only Firefox; not even Chrome.
Re:Qualities that I believe make the most difference in prog... by woah on Tuesday February 28, 2017 @12:16PM (#13755383)
Not to be a fanboy but I use a Mac and one of the things that they clearly did a huge amount of research and fine tuning on is the scrolling. I can always tell when there's non native scrolling on a site and it always sucks. Maybe I'm out of touch, but IMO the smoothness of the scrolling is an OS or hardware level feature. If somebody's OS or hardware does not scroll smoothly, then clearly it's something that they're used to from every other site they visit.

Putting a "smooth scrolling" library in makes about as much sense as rendering all of your site's text on canvas because some computers have font aliasing issues. It reeks of a micromanaging CEO getting fixated on some arbitrary requirement that makes stuff look better only on his computer.

Re:Qualities that I believe make the most difference in prog... by unoti on Wednesday March 01, 2017 @12:02AM (#13761307)
I'm not talking about manually implementing a virtual scrollable canvas. I'm talking about "make item 19 in that list box visible in the middle of It's display area."

I agree that scrolling virtual spaces should be native and hardware accelerated whenever possible, but I think we are talking about different use cases.

Re:Qualities that I believe make the most difference in prog... by collinmanderson on Wednesday March 01, 2017 @09:33PM (#13770927)
document.querySelector('.item-19').scrollIntoView()
Re:Qualities that I believe make the most difference in prog... by T-hawk on Tuesday February 28, 2017 @02:53PM (#13757233)
What web page or application would need smooth scrolling? What can't work with whatever scrolling is normal for the browser/OS/hardware?

Looking cool at the request of some manager does not constitute a need.

Re:Qualities that I believe make the most difference in prog... by unoti on Tuesday February 28, 2017 @11:46PM (#13761211)
Imagine there's a scrollable list of items and you want to scroll one particular item into view when some event happens. Without smooth scroll the item just pops into view and the user may not see it happening. It's a usability issue-- when the user interface jerks instantly, the user can lose context about what's happening. When it's smoothly animated it's easier for the user to keep track of what's happening in the user interface, and to see how one interaction triggers the next.

Done right, animation isn't just snazzy, it produces a more usable, more approachable user interface. It helps the user keep a good mental model of what's going on. It's easier for them to mentally track "ah, when I select this item, it also selects that other item in the other list".

It's the same reason why when you click an app on your phone it animates up from the app icon when the window opens. The animation wordlessly tells the user "I'm opening this app, and the window that's appearing is born of the icon you just clicked." Necessary? Not exactly. More natural? Absolutely. Nothing just snaps into existence in the real world, except for maybe things like lightning.

When things appear out of nowhere it can be jarring. Animation is especially called for when it might not be intuitive why you're making a change to the visual state, or when you want to call attention to something.

Keep in mind that a generation ago, pretty much every piece of software (even games!) came with a printed manual that the user needed to read first before expecting to be able to accomplish anything. Today users expect to be able to figure things out for themselves, and animation is part of the user experience that helps users learn their applications naturally by exploring the user interface.

Re:Qualities that I believe make the most difference in prog... by K0SM0S on Wednesday March 01, 2017 @08:12AM (#13763393)
Exactly, and just we wait for mainstream VR/AR. I believe we'll see quite a lot of animation skeumorphism (is that a thing? I mean realistic animation/appearance relatively to a real world setting, e.g. gravity on objects, diffraction on transparency, etc). For a few years at least, time for users to learn new interaction paradigms and positioning within a virtual/hybrid environment.
Re:Qualities that I believe make the most difference in prog... by bigmanwalter on Tuesday February 28, 2017 @06:04PM (#13759111)
This is what I use right now for cross-browser smooth scrolling. It's native first with a jQuery fallback.

  <style>
      html, body {
          scroll-behavior: smooth;
      }
  </style>

  <script>
      // Uses native smooth scrolling if available, otherwise uses a jQuery fallback
      // Just add data-scroll attribute to any anchor you want to make smooth
      // Add data-scroll-header to a sticky nav / header to offset the window top
      if (!('scrollBehavior' in document.documentElement.style)) {
          // jQuery fallback
          // Taken from https://css-tricks.com/snippets/jquery/smooth-scrolling/
          $('[data-scroll]').click(function() {
              if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
                  var target = $(this.hash);
                  target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
                  if (target.length) {
                      $('html, body').animate({
                          scrollTop: target.offset().top - $('[data-scroll-header]').height()
                      }, 600);
                      return false;
                  }
              }
          });
      }
  </script>
Re:Qualities that I believe make the most difference in prog... by cabalamat on Wednesday March 01, 2017 @10:36AM (#13764472)
> If you need smooth scroll

Why would I need smooth scroll? All it achieves is slows down the scrolling so it takes me longer to get to where i want to in the page.