Guest User

Untitled

a guest
Feb 21st, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 KB | None | 0 0
  1. $(window).load(function(){
  2.  
  3. $('body').hide().show(); //fix invisible fonts on refresh.
  4.  
  5. //product thumbnails swiper
  6. var product_thumbnails_swiper = $('.product_thumbnails .product_thumbnails_swiper_container').swiper({
  7. slidesPerView: "auto",
  8. watchActiveIndex: true,
  9. mousewheelControl: true,
  10. mode:'vertical',
  11. onSlideClick : function(swiper) {
  12. owl.goTo(product_thumbnails_swiper.clickedSlideIndex);
  13. for (var i = 0; i < product_thumbnails_swiper.slides.length; i++){
  14. product_thumbnails_swiper.slides[i].style.opacity = 0.2;
  15. product_thumbnails_swiper.slides[i].style.cursor = 'pointer';
  16. }
  17. product_thumbnails_swiper.slides[product_thumbnails_swiper.clickedSlideIndex].style.opacity = 1;
  18. product_thumbnails_swiper.slides[product_thumbnails_swiper.clickedSlideIndex].style.cursor = 'default';
  19. product_thumbnails_swiper.swipeTo(product_thumbnails_swiper.clickedSlideIndex, 300, '');
  20. }
  21. });
  22.  
  23.  
  24. //owl
  25.  
  26. var curent_dragging_item;
  27.  
  28. $(".featured_img_temp").hide();
  29.  
  30. $("#product-images-carousel").owlCarousel({
  31. singleItem : true,
  32. autoHeight : true,
  33. transitionStyle:"fade",
  34. lazyLoad : true,
  35. slideSpeed : 300,
  36. dragBeforeAnimFinish: false,
  37. afterAction : afterAction,
  38. beforeUpdate : function() {},
  39. startDragging:function() {},
  40. afterMove:function() {}
  41. });
  42.  
  43. //get carousel instance data and store it in variable owl
  44. var owl = $("#product-images-carousel").data('owlCarousel');
  45.  
  46. function afterAction() {
  47. /*jshint validthis: true */
  48.  
  49. $('.product_thumbnails_swiper_container').css('max-height', $('.product_images').height());
  50.  
  51. if ($(".product_thumbnails").length) {
  52.  
  53. for (var i = 0; i < product_thumbnails_swiper.slides.length; i++){
  54. product_thumbnails_swiper.slides[i].style.opacity = 0.2;
  55. }
  56. product_thumbnails_swiper.slides[this.owl.currentItem].style.opacity = 1;
  57. product_thumbnails_swiper.swipeTo(this.owl.currentItem, 300, '');
  58. }
  59.  
  60. }
  61.  
  62. //Product Gallery zoom
  63. if ($(".easyzoom").length ) {
  64. if ( $(window).width() > 1024 ) {
  65. var $easyzoom = $(".easyzoom").easyZoom({
  66. loadingNotice: '',
  67. errorNotice: '',
  68. preventClicks: false,
  69. });
  70.  
  71. var easyzoom_api = $easyzoom.data('easyZoom');
  72.  
  73. $(".variations").on('change', 'select', function() {
  74. owl.goTo(0);
  75. easyzoom_api.teardown();
  76. easyzoom_api._init();
  77. });
  78. }
  79. }
  80.  
  81. setTimeout(function() {
  82. $(".product_thumbnail.with_second_image").css("background-size", "cover");
  83. $(".product_thumbnail.with_second_image").addClass("second_image_loaded");
  84. }, 300);
  85.  
  86. if ($(window).outerWidth() > 1024) {
  87. $.stellar({
  88. horizontalScrolling: false,
  89. responsive: true
  90. });
  91. }
  92.  
  93. setTimeout(function(){
  94. $('.parallax, .single-post-header-bkg').addClass('loaded');
  95. },150)
  96.  
  97. });
Add Comment
Please, Sign In to add comment