A self hosted chat application with end-to-end encrypted messaging.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.5 KiB

  1. (function($) {
  2. "use strict"; // Start of use strict
  3. // Toggle the side navigation
  4. $("#sidebarToggle, #sidebarToggleTop").on('click', function(e) {
  5. $("body").toggleClass("sidebar-toggled");
  6. $(".sidebar").toggleClass("toggled");
  7. if ($(".sidebar").hasClass("toggled")) {
  8. $('.sidebar .collapse').collapse('hide');
  9. };
  10. });
  11. // Close any open menu accordions when window is resized below 768px
  12. $(window).resize(function() {
  13. if ($(window).width() < 768) {
  14. $('.sidebar .collapse').collapse('hide');
  15. };
  16. });
  17. // Prevent the content wrapper from scrolling when the fixed side navigation hovered over
  18. $('body.fixed-nav .sidebar').on('mousewheel DOMMouseScroll wheel', function(e) {
  19. if ($(window).width() > 768) {
  20. var e0 = e.originalEvent,
  21. delta = e0.wheelDelta || -e0.detail;
  22. this.scrollTop += (delta < 0 ? 1 : -1) * 30;
  23. e.preventDefault();
  24. }
  25. });
  26. // Scroll to top button appear
  27. $(document).on('scroll', function() {
  28. var scrollDistance = $(this).scrollTop();
  29. if (scrollDistance > 100) {
  30. $('.scroll-to-top').fadeIn();
  31. } else {
  32. $('.scroll-to-top').fadeOut();
  33. }
  34. });
  35. // Smooth scrolling using jQuery easing
  36. $(document).on('click', 'a.scroll-to-top', function(e) {
  37. var $anchor = $(this);
  38. $('html, body').stop().animate({
  39. scrollTop: ($($anchor.attr('href')).offset().top)
  40. }, 1000, 'easeInOutExpo');
  41. e.preventDefault();
  42. });
  43. })(jQuery); // End of use strict