"My JS-JQ Reference"
Bootstrap 4.1.1 Snippet by mastersujit7

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>This is my page for reference </h2> </div> </div>
// onclick toggle // =================== <script> $(document).ready(function() { $("#flip").click(function() { $("#panel").slideToggle("slow"); }); }); </script> // onscroll navbar shrink // ========================== <script> // When the user scrolls down 80px from the top of the document, resize the navbar's padding and the logo's font size window.onscroll = function() { scrollFunction() }; function scrollFunction() { if (document.body.scrollTop > 80 || document.documentElement.scrollTop > 80) { document.getElementById("site-navbar").style.padding = "0px"; } else { document.getElementById("site-navbar").style.padding = "15px"; } } </script> // div show on scroll // ===================== <script> $(window).scroll(function() { if ($(window).scrollTop() > 80) { $("#gototop").fadeIn("slow"); } else { $("#gototop").fadeOut("fast"); } }); </script> // smooth scroll to top on click a div // ======================================= <script> $("#gototop").on('click', function(e) { e.preventDefault(); var target = $(this).attr('href'); $('html, body').animate({ scrollTop: ($(target).offset().top) }, 1000); }); </script> // onscrolldown header hide and onscrollup header show // https://codepen.io/vivinantony/pen/XXWoQx // http://jsfiddle.net/mariusc23/s6mLJ/31/ // =================================================== <script> // Hide Header on on scroll down var didScroll; var lastScrollTop = 0; var delta = 5; var navbarHeight = $('header').outerHeight(); $(window).scroll(function(event) { didScroll = true; }); setInterval(function() { if (didScroll) { hasScrolled(); didScroll = false; } }, 250); function hasScrolled() { var st = $(this).scrollTop(); // Make sure they scroll more than delta if (Math.abs(lastScrollTop - st) <= delta) return; // If they scrolled down and are past the navbar, add class .nav-up. // This is necessary so you never see what is "behind" the navbar. if (st > lastScrollTop && st > navbarHeight) { // Scroll Down $('header').removeClass('nav-down').addClass('nav-up'); } else { // Scroll Up if (st + $(window).height() < $(document).height()) { $('header').removeClass('nav-up').addClass('nav-down'); } } lastScrollTop = st; } </script>

Related: See More


Questions / Comments: