From c8e38c30e6b60e08fa5969cacd3bdedf7a2f2aaf Mon Sep 17 00:00:00 2001 From: kateryna saprunova Date: Fri, 25 Oct 2019 17:26:57 +0200 Subject: [PATCH] refactor: iOS page improvements and css fixes 1. Changed active colour of the links and buttons. 2. Fixed the issue with scrolling to the anchor point. 3. Changed content of the Pybytes iOS page --- themes/doc-theme/static/js/smooth-scroll.js | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 themes/doc-theme/static/js/smooth-scroll.js diff --git a/themes/doc-theme/static/js/smooth-scroll.js b/themes/doc-theme/static/js/smooth-scroll.js new file mode 100644 index 0000000..b6cfbf5 --- /dev/null +++ b/themes/doc-theme/static/js/smooth-scroll.js @@ -0,0 +1,23 @@ +/* +* Smooth scroll to anchor link +*/ + + +$(document).ready(function(){ + $( 'a[href^="#"]' ).on( 'click', function( e ) { + + if ( this.hash !== '' ) { + e.preventDefault(); + + var hash = this.hash; + var nav = $( '.navbar' ).outerHeight(); + var targetOffset = $( hash ).offset().top - nav; + + $( 'html, body' ).animate( { + scrollTop: targetOffset + }, 1100, function() { + //window.location.hash = hash; + } ); + } + } ); +} );