common.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. $(function (){
  2. $("img.lazy").lazyload({ effect:"fadeIn" });
  3. if($('.swiper-container')[0]){
  4. var swiper = new Swiper('.swiper-container', {
  5. slidesPerView: 1,
  6. spaceBetween: 30,
  7. loop: true,
  8. autoplay: {
  9. delay: 5000,
  10. disableOnInteraction: false
  11. },
  12. pagination: {
  13. el: '.swiper-pagination',
  14. clickable: true
  15. }
  16. });
  17. }
  18. var navPos = $(".navigation-wrap").offset();
  19. $(".welcome-notice").css({
  20. "left": (navPos.left + 1200 - $(".welcome-notice").width()) + "px",
  21. "top": (navPos.top + 38) + "px"
  22. }).show();
  23. $(".list-wares ul li,.sales-ranking-text ul li").on({
  24. mouseover: function (){
  25. $(".group-layer-box",this).stop(false,false).fadeIn();
  26. },
  27. mouseout: function (){
  28. $(".group-layer-box",this).stop(false,false).fadeOut();
  29. }
  30. });
  31. $(".product-categories").on("mouseover",function(){
  32. $(".category-menu-box").show();
  33. }).on("mouseout",function(){
  34. $(".category-menu-box").hide();
  35. });
  36. $(".wares-cent").on("mouseover",function(){
  37. $(this).find(".carte-combobox").show();
  38. }).on("mouseout",function(){
  39. $(this).find(".carte-combobox").hide();
  40. });
  41. $(".settlement-cart").on("mouseover",function (){
  42. $(".shopping-drop").show();
  43. }).on("mouseout",function (){
  44. $(".shopping-drop").hide();
  45. });
  46. $(".top-left li").on("mouseover",function (){
  47. var index = $(".top-left li").index($(this));
  48. $(".top-left li").removeClass("curren").eq(index).addClass("curren");
  49. $(".top-dropdown",this).show();
  50. }).on("mouseout",function (){
  51. $(".top-left li").removeClass("curren");
  52. $(".top-dropdown",this).hide();
  53. });
  54. $(".cosy-cent").on("mouseover",function (){
  55. $(".share-details").show();
  56. }).on("mouseout",function (){
  57. $(".share-details").hide();
  58. });
  59. $(".goods-tab-box").first().show();
  60. $(".product-commodity-title li").first().addClass("descri-curren");
  61. $(".product-commodity-title li").on("click",function (){
  62. var index = $(".product-commodity-title li").index($(this));
  63. $(".goods-tab-box").hide().eq(index).show();
  64. $(".product-commodity-title li").removeClass("descri-curren").eq(index).addClass("descri-curren");
  65. });
  66. $('.product-left-details').myZoom();
  67. });
  68. ;(function ($) {
  69. $.fn.myZoom = function (){
  70. if ($(this).size() <= 0) return;
  71. $(".image-zoom").elevateZoom({
  72. scrollZoom: false, cursor: 'pointer',easing: true,
  73. zoomWindowFadeIn: 500,
  74. zoomWindowFadeOut: 500,
  75. zoomWindowWidth: 420,
  76. zoomWindowHeight: 420,
  77. borderSize: 0,lensBorderSize: 0,
  78. lensFadeIn: 200,
  79. lensFadeOut: 200
  80. });
  81. $('.details-small li').each(function (){
  82. $(this).on('mouseover',function (){
  83. var smallImage = $('img',this).attr('data-image');
  84. var largeImage = $('img',this).attr('data-zoom-image');
  85. var ez = $('.image-zoom').data('elevateZoom');
  86. ez.swaptheimage(smallImage, largeImage);
  87. });
  88. });
  89. $('.details-small').showImage();
  90. };
  91. $.fn.showImage = function (){
  92. if($(this).size() <= 0) return ;
  93. var pssListUl = $('ul',this);
  94. var pssListLi = $('ul li',this);
  95. var prev = $('.prev-btn');
  96. var next = $('.next-btn');
  97. var sWidth = pssListLi.outerWidth(true);
  98. var iNow=0;
  99. pssListUl.width(pssListLi.size() * (sWidth));
  100. var move = function(index) {
  101. pssListUl.stop().animate({
  102. left: -index * (sWidth)
  103. }, 450);
  104. };
  105. prev.click(function (){
  106. if(pssListLi.size() <= 5){
  107. iNow--;
  108. }else if (iNow <= 0) {
  109. return false;
  110. } else {
  111. iNow--;
  112. move(iNow);
  113. }
  114. return false;
  115. });
  116. next.click(function (){
  117. if (iNow == pssListLi.size() - 5) {
  118. return false;
  119. } else if(pssListLi.size() <= 5){
  120. return false;
  121. }else{
  122. iNow++;
  123. }
  124. move(iNow);
  125. return false;
  126. });
  127. };
  128. })(jQuery);