$(document).on("scroll", onScroll); //smoothscroll $('.page-template-cannabis-101 .c-secondary-nav a[href^="#"]').on('click', function (e) { // e.preventDefault(); // $(document).off("scroll"); // $('.page-template-cannabis-101 .c-secondary-nav a').each(function () { // $(this).removeClass('active'); // }) // $(this).addClass('active'); // var target = this.hash, // menu = target; // $target = $(target); $('html, body').stop().animate({ 'scrollTop': $target.offset().top + 2 }, 500, 'swing', function () { window.location.hash = target; $(document).on("scroll", onScroll); }); });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter