1(function($) { 2 "use strict"; // Start of use strict 3 4 // Toggle the side navigation 5 $("#sidebarToggle, #sidebarToggleTop").on('click', function(e) { 6 $("body").toggleClass("sidebar-toggled"); 7 $(".sidebar").toggleClass("toggled"); 8 9 if ($(".sidebar").hasClass("toggled")) { 10 $('.sidebar .collapse').collapse('hide'); 11 // Replace logo 12 $('#sidebar-logo').attr("src", "/assets/images/pw-logo-small.jpg"); 13 } else { 14 $('#sidebar-logo').attr("src", "/assets/images/portal-logo.jpg"); 15 } 16 }); 17 18 // Close any open menu accordions when window is resized below 768px 19 $(window).resize(function() { 20 if ($(window).width() < 768) { 21 $('.sidebar .collapse').collapse('hide'); 22 } 23 24 // Toggle the side navigation when window is resized below 480px 25 if ($(window).width() < 480 && !$(".sidebar").hasClass("toggled")) { 26 $("body").addClass("sidebar-toggled"); 27 $(".sidebar").addClass("toggled"); 28 $('.sidebar .collapse').collapse('hide'); 29 } 30 }); 31 32 // Prevent the content wrapper from scrolling when the fixed side navigation hovered over 33 $('body.fixed-nav .sidebar').on('mousewheel DOMMouseScroll wheel', function(e) { 34 if ($(window).width() > 768) { 35 var e0 = e.originalEvent, 36 delta = e0.wheelDelta || -e0.detail; 37 this.scrollTop += (delta < 0 ? 1 : -1) * 30; 38 e.preventDefault(); 39 } 40 }); 41 42 // Scroll to top button appear 43 $(document).on('scroll', function() { 44 var scrollDistance = $(this).scrollTop(); 45 if (scrollDistance > 100) { 46 $('.scroll-to-top').fadeIn(); 47 } else { 48 $('.scroll-to-top').fadeOut(); 49 } 50 }); 51 52 // Smooth scrolling using jQuery easing 53 $(document).on('click', 'a.scroll-to-top', function(e) { 54 var $anchor = $(this); 55 $('html, body').stop().animate({ 56 scrollTop: ($($anchor.attr('href')).offset().top) 57 }, 1000, 'easeInOutExpo'); 58 e.preventDefault(); 59 }); 60 61 // Hide collapse when click outside 62 $(document).click( 63 function (event) { 64 var target = $(event.target); 65 66 // Is the click not .nav-link? 67 if (!target.hasClass("nav-link") && !target.parent().hasClass("nav-link")) { 68 // Get open menu 69 var collapsed = $('.sidebar .collapse.show'); 70 71 if (collapsed.length == 1 && $(".sidebar").hasClass("toggled")) { 72 collapsed.collapse('toggle'); 73 } 74 } 75 } 76 ); 77 78 // Init tooltips 79 $('[data-toggle="tooltip"]').tooltip(); 80 81 82 83})(jQuery); // End of use strict
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.