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.

script.js 4.8KB

4 년 전
4 년 전
4 년 전
4 년 전
4 년 전
4 년 전
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* ========================================================================= */
  2. /* Page Preloader
  3. /* ========================================================================= */
  4. $(window).on('load', function () {
  5. $('.preloader').fadeOut(100);
  6. });
  7. // Auto close Navbar when click on link
  8. $('.navbar-collapse a').click(function(){
  9. $(".navbar-collapse").collapse('hide');
  10. });
  11. jQuery(function ($) {
  12. "use strict";
  13. /* ========================================================================= */
  14. /* lazy load initialize
  15. /* ========================================================================= */
  16. const observer = lozad(); // lazy loads elements with default selector as ".lozad"
  17. observer.observe();
  18. /* ========================================================================= */
  19. /* Magnific popup
  20. /* ========================================================================= */
  21. $('.image-popup').magnificPopup({
  22. type: 'image',
  23. removalDelay: 160, //delay removal by X to allow out-animation
  24. callbacks: {
  25. beforeOpen: function () {
  26. // just a hack that adds mfp-anim class to markup
  27. this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
  28. this.st.mainClass = this.st.el.attr('data-effect');
  29. }
  30. },
  31. closeOnContentClick: true,
  32. midClick: true,
  33. fixedContentPos: false,
  34. fixedBgPos: true
  35. });
  36. /* ========================================================================= */
  37. /* Portfolio Filtering Hook
  38. /* ========================================================================= */
  39. var containerEl = document.querySelector('.shuffle-wrapper');
  40. if (containerEl) {
  41. var Shuffle = window.Shuffle;
  42. var myShuffle = new Shuffle(document.querySelector('.shuffle-wrapper'), {
  43. itemSelector: '.shuffle-item',
  44. buffer: 1
  45. });
  46. jQuery('input[name="shuffle-filter"]').on('change', function (evt) {
  47. var input = evt.currentTarget;
  48. if (input.checked) {
  49. myShuffle.filter(input.value);
  50. }
  51. });
  52. }
  53. /* ========================================================================= */
  54. /* Testimonial Carousel
  55. /* ========================================================================= */
  56. $("#testimonials").slick({
  57. infinite: true,
  58. arrows: false,
  59. autoplay: true,
  60. autoplaySpeed: 4000
  61. });
  62. /* ========================================================================= */
  63. /* animation scroll js
  64. /* ========================================================================= */
  65. var html_body = $('html, body');
  66. $('nav a, .page-scroll').on('click', function () { //use page-scroll class in any HTML tag for scrolling
  67. if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) {
  68. var target = $(this.hash);
  69. target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
  70. if (target.length) {
  71. html_body.animate({
  72. scrollTop: target.offset().top - 50
  73. }, 1500, 'easeInOutExpo');
  74. return false;
  75. }
  76. }
  77. });
  78. // easeInOutExpo Declaration
  79. jQuery.extend(jQuery.easing, {
  80. easeInOutExpo: function (x, t, b, c, d) {
  81. if (t === 0) {
  82. return b;
  83. }
  84. if (t === d) {
  85. return b + c;
  86. }
  87. if ((t /= d / 2) < 1) {
  88. return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
  89. }
  90. return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
  91. }
  92. });
  93. /* ========================================================================= */
  94. /* counter up
  95. /* ========================================================================= */
  96. function counter() {
  97. var oTop;
  98. if ($('.count').length !== 0) {
  99. oTop = $('.count').offset().top - window.innerHeight;
  100. }
  101. if ($(window).scrollTop() > oTop) {
  102. $('.count').each(function () {
  103. var $this = $(this),
  104. countTo = $this.attr('data-count');
  105. $({
  106. countNum: $this.text()
  107. }).animate({
  108. countNum: countTo
  109. }, {
  110. duration: 1000,
  111. easing: 'swing',
  112. step: function () {
  113. $this.text(Math.floor(this.countNum));
  114. },
  115. complete: function () {
  116. $this.text(this.countNum);
  117. }
  118. });
  119. });
  120. }
  121. }
  122. $(window).on('scroll', function () {
  123. counter();
  124. });
  125. });
  126. function downloadEvent(){
  127. var subject = $('#subject').val();
  128. var description = $('#description').val();
  129. description = 'Please join here ' + description;
  130. //description = $('.post-single-content').html();
  131. // description = description.replace(/\n/g , '\\n');
  132. // description = description.replace(/\r\n/g , '\\n');
  133. // description = description.replace(/<br>/g , '\\n');
  134. var location = $('#location').val();
  135. var begin = $('#start-date').val();
  136. var end = $('#end-date').val();
  137. var filename = $('#filename').val();
  138. if(filename==='')
  139. filename= subject;
  140. var cal = ics();
  141. cal.addEvent(subject, description, location, begin, end);
  142. //cal.addEvent(subject, description, location, begin, end); // yes, you can have multiple events :-)
  143. cal.download(filename)
  144. }