switcher.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Swticher Cookie Base
  2. /**
  3. * Styleswitch stylesheet switcher built on jQuery
  4. * Under an Attribution, Share Alike License
  5. * By Kelvin Luck ( http://www.kelvinluck.com/ )
  6. * Thanks for permission!
  7. **/
  8. // DEMO Swticher Base
  9. jQuery('.demo-icon').click(function () {
  10. if ($('.demo_changer').hasClass("active")) {
  11. $('.demo_changer').animate({ "inset-inline-end": "-270px" }, function () {
  12. $('.demo_changer').toggleClass("active");
  13. });
  14. } else {
  15. $('.demo_changer').animate({ "inset-inline-end": "0px" }, function () {
  16. $('.demo_changer').toggleClass("active");
  17. });
  18. }
  19. });
  20. if ((document.querySelector('.sidebar-right1') !== null)) {
  21. //p-scroll bar
  22. const ps5 = new PerfectScrollbar('.sidebar-right1', {
  23. useBothWheelAxes: true,
  24. suppressScrollX: true,
  25. });
  26. }
  27. mainContent = document.querySelector('.main-content');
  28. logIn = document.querySelector(".login-img .page")
  29. // Switcher Close //
  30. if ((mainContent !== null)) {
  31. mainContent.addEventListener("click", function () {
  32. if ($('.demo_changer').hasClass("active")) {
  33. $('.demo_changer').animate({ "inset-inline-end": "-270px" }, function () {
  34. $('.demo_changer').toggleClass("active");
  35. });
  36. }
  37. });
  38. }
  39. // COVER IMAGE
  40. $(".cover-image").each(function () {
  41. var attr = $(this).attr('data-bs-image-src');
  42. if (typeof attr !== typeof undefined && attr !== false) {
  43. $(this).css('background', 'url(' + attr + ') center center');
  44. }
  45. });
  46. if ((logIn !== null)) {
  47. logIn.addEventListener("click", function () {
  48. if ($('.demo_changer').hasClass("active")) {
  49. $('.demo_changer').animate({ "inset-inline-end": "-270px" }, function () {
  50. $('.demo_changer').toggleClass("active");
  51. });
  52. }
  53. });
  54. }