smooth-scrolling

Center a section when using smooth scroll

心已入冬 提交于 2021-02-11 18:19:19
问题 I am using Chris Ferdinandi's Smooth Scroll script and I am trying to have it scroll to an element, but land with that element centred. Similarly to what is done at http://www.spotify.com. I attempted adding the following code to the start of the script: $(document).ready(function(){ $('.downarrow a').click(elementhref = $('.downarrow a').attr('href')); var elementheight = $(elementhref).height(); var windowheight = $(window).height(); if (elementheight < windowheight) { topoffset = (

Center a section when using smooth scroll

ⅰ亾dé卋堺 提交于 2021-02-11 18:18:16
问题 I am using Chris Ferdinandi's Smooth Scroll script and I am trying to have it scroll to an element, but land with that element centred. Similarly to what is done at http://www.spotify.com. I attempted adding the following code to the start of the script: $(document).ready(function(){ $('.downarrow a').click(elementhref = $('.downarrow a').attr('href')); var elementheight = $(elementhref).height(); var windowheight = $(window).height(); if (elementheight < windowheight) { topoffset = (

webkit-overflow-scrolling makes element disappear

前提是你 提交于 2021-02-08 10:35:20
问题 I have an app / site where I'm using -webkit-overflow-scrolling: touch; to make the scrolling smooth on iOS. However, recently it started causing my navbar disappear upon initial load (using iOS) and it only appears when certain elements were scrolled up or down, it makes the navbar completely unusable. If I comment out the -webkit-overflow-scrolling: touch; then it works perfectly but the momentum scrolling is gone. I've tried adding a z-index hack to the navbar to make sure it's loading on

How to make Element.scrollIntoView() on Chromium-based browsers not depend on smooth-scrolling flag?

你离开我真会死。 提交于 2021-01-21 05:13:53
问题 I have a JavaScript function that attempts to smoothly scroll an element into view: dom_element.scrollIntoView({ 'behavior': 'smooth', 'block': 'nearest' }); On Firefox, this works perfectly fine. But I realized that scrolling was instant, i.e. not respecting behaviour': 'smooth' on Chromium-based browsers (Chrome, Opera, Brave). Both MDN and caniuse.com showed that Chrome supported behaviour: smooth , so I was quite puzzled. After a frustrating hour of debugging, I realized that the code

How to make Element.scrollIntoView() on Chromium-based browsers not depend on smooth-scrolling flag?

a 夏天 提交于 2021-01-21 05:13:02
问题 I have a JavaScript function that attempts to smoothly scroll an element into view: dom_element.scrollIntoView({ 'behavior': 'smooth', 'block': 'nearest' }); On Firefox, this works perfectly fine. But I realized that scrolling was instant, i.e. not respecting behaviour': 'smooth' on Chromium-based browsers (Chrome, Opera, Brave). Both MDN and caniuse.com showed that Chrome supported behaviour: smooth , so I was quite puzzled. After a frustrating hour of debugging, I realized that the code

How to make Element.scrollIntoView() on Chromium-based browsers not depend on smooth-scrolling flag?

十年热恋 提交于 2021-01-21 05:10:21
问题 I have a JavaScript function that attempts to smoothly scroll an element into view: dom_element.scrollIntoView({ 'behavior': 'smooth', 'block': 'nearest' }); On Firefox, this works perfectly fine. But I realized that scrolling was instant, i.e. not respecting behaviour': 'smooth' on Chromium-based browsers (Chrome, Opera, Brave). Both MDN and caniuse.com showed that Chrome supported behaviour: smooth , so I was quite puzzled. After a frustrating hour of debugging, I realized that the code

How to make Element.scrollIntoView() on Chromium-based browsers not depend on smooth-scrolling flag?

倾然丶 夕夏残阳落幕 提交于 2021-01-21 05:10:06
问题 I have a JavaScript function that attempts to smoothly scroll an element into view: dom_element.scrollIntoView({ 'behavior': 'smooth', 'block': 'nearest' }); On Firefox, this works perfectly fine. But I realized that scrolling was instant, i.e. not respecting behaviour': 'smooth' on Chromium-based browsers (Chrome, Opera, Brave). Both MDN and caniuse.com showed that Chrome supported behaviour: smooth , so I was quite puzzled. After a frustrating hour of debugging, I realized that the code