SWIPER
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
5 changed files
with
20 additions
and
8 deletions
| ... | @@ -26124,6 +26124,7 @@ | ... | @@ -26124,6 +26124,7 @@ |
| 26124 | jQuery(document).ready(function ($) { | 26124 | jQuery(document).ready(function ($) { |
| 26125 | jQuery('.carousel-items').each(function () { | 26125 | jQuery('.carousel-items').each(function () { |
| 26126 | var _id = jQuery(this).parent().attr('id'); | 26126 | var _id = jQuery(this).parent().attr('id'); |
| 26127 | var thisSwiper = this; | ||
| 26127 | var swiper_params = { | 26128 | var swiper_params = { |
| 26128 | modules: [Navigation, Pagination, A11y, Keyboard], | 26129 | modules: [Navigation, Pagination, A11y, Keyboard], |
| 26129 | slidesOffsetAfter: 0, | 26130 | slidesOffsetAfter: 0, |
| ... | @@ -26160,9 +26161,17 @@ | ... | @@ -26160,9 +26161,17 @@ |
| 26160 | } | 26161 | } |
| 26161 | } | 26162 | } |
| 26162 | }; | 26163 | }; |
| 26163 | if ($(window).width() > 1074) { | 26164 | var mySwiper = new Swiper(thisSwiper, swiper_params); |
| 26164 | new Swiper(this, swiper_params); | 26165 | if ($(window).width() < 1074) { |
| 26166 | mySwiper.destroy(false, true); | ||
| 26165 | } | 26167 | } |
| 26168 | $(window).on('resize', function () { | ||
| 26169 | if ($(window).width() > 1074) { | ||
| 26170 | mySwiper = new Swiper(thisSwiper, swiper_params); | ||
| 26171 | } else { | ||
| 26172 | mySwiper.destroy(false, true); | ||
| 26173 | } | ||
| 26174 | }); | ||
| 26166 | }); | 26175 | }); |
| 26167 | // $('.carousel ').css('margin-left',"-"+$('#content').css('margin-left')); | 26176 | // $('.carousel ').css('margin-left',"-"+$('#content').css('margin-left')); |
| 26168 | 26177 | ... | ... |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
| ... | @@ -21,6 +21,7 @@ jQuery(document).ready(function($) { | ... | @@ -21,6 +21,7 @@ jQuery(document).ready(function($) { |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | var _id = jQuery(this).parent().attr('id'); | 23 | var _id = jQuery(this).parent().attr('id'); |
| 24 | var thisSwiper = this; | ||
| 24 | 25 | ||
| 25 | var swiper_params = { | 26 | var swiper_params = { |
| 26 | modules: [Navigation, Pagination, A11y, Keyboard], | 27 | modules: [Navigation, Pagination, A11y, Keyboard], |
| ... | @@ -62,20 +63,22 @@ jQuery(document).ready(function($) { | ... | @@ -62,20 +63,22 @@ jQuery(document).ready(function($) { |
| 62 | }, | 63 | }, |
| 63 | 64 | ||
| 64 | }; | 65 | }; |
| 65 | var mySwiper; | 66 | var mySwiper = new Swiper(thisSwiper, swiper_params); |
| 66 | if ($(window).width() > 1074) { | 67 | |
| 67 | mySwiper = new Swiper(this, swiper_params); | 68 | if ($(window).width() < 1074) { |
| 69 | mySwiper.destroy(false, true); | ||
| 68 | }; | 70 | }; |
| 71 | |||
| 69 | $(window).on('resize', function(){ | 72 | $(window).on('resize', function(){ |
| 70 | if ($(window).width() > 1074) { | 73 | if ($(window).width() > 1074) { |
| 71 | mySwiper = new Swiper(this, swiper_params); | 74 | mySwiper = new Swiper(thisSwiper, swiper_params); |
| 72 | }else{ | 75 | }else{ |
| 73 | mySwiper.destroy(true, true) | 76 | mySwiper.destroy(false, true); |
| 74 | } | 77 | } |
| 75 | }); | 78 | }); |
| 76 | 79 | ||
| 77 | 80 | ||
| 78 | }); | 81 | |
| 79 | 82 | ||
| 80 | }); | 83 | }); |
| 81 | // $('.carousel ').css('margin-left',"-"+$('#content').css('margin-left')); | 84 | // $('.carousel ').css('margin-left',"-"+$('#content').css('margin-left')); | ... | ... |
-
Please register or sign in to post a comment