cloud-zoom1.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. //////////////////////////////////////////////////////////////////////////////////
  2. // Cloud Zoom V1.0.2.5
  3. // (c) 2010 by R Cecco. <http://www.professorcloud.com>
  4. // with enhancements by Philipp Andreas <https://github.com/smurfy/cloud-zoom>
  5. //
  6. // MIT License
  7. //
  8. // Please retain this copyright header in all versions of the software
  9. //////////////////////////////////////////////////////////////////////////////////
  10. (function ($) {
  11. $(document).ready(function () {
  12. $('.cloud-zoom, .cloud-zoom-gallery').CloudZoom();
  13. });
  14. function getWidthBrowser() {
  15. var myWidth = 0;
  16. if( typeof( window.innerWidth ) == 'number' ) {
  17. //Non-IE
  18. myWidth = window.innerWidth;
  19. //myHeight = window.innerHeight;
  20. }
  21. else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
  22. //IE 6+ in 'standards compliant mode'
  23. myWidth = document.documentElement.clientWidth;
  24. //myHeight = document.documentElement.clientHeight;
  25. }
  26. else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
  27. //IE 4 compatible
  28. myWidth = document.body.clientWidth;
  29. //myHeight = document.body.clientHeight;
  30. }
  31. return myWidth;
  32. }
  33. var window_width=getWidthBrowser();
  34. function format(str) {
  35. for (var i = 1; i < arguments.length; i++) {
  36. str = str.replace('%' + (i - 1), arguments[i]);
  37. }
  38. return str;
  39. }
  40. function CloudZoom(jWin, opts) {
  41. //alert(window_width);
  42. var sImg = $('img', jWin);
  43. var img1;
  44. var img2;
  45. var zoomDiv = null;
  46. var $mouseTrap = null;
  47. var lens = null;
  48. var $tint = null;
  49. var softFocus = null;
  50. var $ie6Fix = null;
  51. var zoomImage;
  52. var controlTimer = 0;
  53. var cw, ch;
  54. var destU = 0;
  55. var destV = 0;
  56. var currV = 0;
  57. var currU = 0;
  58. var filesLoaded = 0;
  59. var mx,
  60. my;
  61. var ctx = this, zw;
  62. // Display an image loading message. This message gets deleted when the images have loaded and the zoom init function is called.
  63. // We add a small delay before the message is displayed to avoid the message flicking on then off again virtually immediately if the
  64. // images load really fast, e.g. from the cache.
  65. //var ctx = this;
  66. setTimeout(function () {
  67. // <img src="/images/loading.gif"/>
  68. if ($mouseTrap === null) {
  69. var w = jWin.width();
  70. jWin.parent().append(format('<div style="width:%0px;position:absolute;top:75%;left:%1px;text-align:center" class="cloud-zoom-loading" >Loading...</div>', w / 3, (w / 2) - (w / 6))).find(':last').css('opacity', 0.5);
  71. }
  72. }, 200);
  73. var ie6FixRemove = function () {
  74. if ($ie6Fix !== null) {
  75. $ie6Fix.remove();
  76. $ie6Fix = null;
  77. }
  78. };
  79. // Removes cursor, tint layer, blur layer etc.
  80. this.removeBits = function () {
  81. //$mouseTrap.unbind();
  82. if (lens) {
  83. lens.remove();
  84. lens = null;
  85. }
  86. if ($tint) {
  87. $tint.remove();
  88. $tint = null;
  89. }
  90. if (softFocus) {
  91. softFocus.remove();
  92. softFocus = null;
  93. }
  94. ie6FixRemove();
  95. $('.cloud-zoom-loading', jWin.parent()).remove();
  96. };
  97. this.destroy = function () {
  98. jWin.data('zoom', null);
  99. if ($mouseTrap) {
  100. $mouseTrap.unbind();
  101. $mouseTrap.remove();
  102. $mouseTrap = null;
  103. }
  104. if (zoomDiv) {
  105. zoomDiv.remove();
  106. zoomDiv = null;
  107. }
  108. //ie6FixRemove();
  109. this.removeBits();
  110. // DON'T FORGET TO REMOVE JQUERY 'DATA' VALUES
  111. };
  112. // This is called when the zoom window has faded out so it can be removed.
  113. this.fadedOut = function () {
  114. if (zoomDiv) {
  115. zoomDiv.remove();
  116. zoomDiv = null;
  117. }
  118. this.removeBits();
  119. //ie6FixRemove();
  120. };
  121. this.controlLoop = function () {
  122. if (lens) {
  123. var x = (mx - sImg.offset().left - (cw * 0.5)) >> 0;
  124. var y = (my - sImg.offset().top - (ch * 0.5)) >> 0;
  125. if (x < 0) {
  126. x = 0;
  127. }
  128. else if (x > (sImg.outerWidth() - cw)) {
  129. x = (sImg.outerWidth() - cw);
  130. }
  131. if (y < 0) {
  132. y = 0;
  133. }
  134. else if (y > (sImg.outerHeight() - ch)) {
  135. y = (sImg.outerHeight() - ch);
  136. }
  137. lens.css({
  138. left: x,
  139. top: y
  140. });
  141. lens.css('background-position', (-x) + 'px ' + (-y) + 'px');
  142. destU = (((x) / sImg.outerWidth()) * zoomImage.width) >> 0;
  143. destV = (((y) / sImg.outerHeight()) * zoomImage.height) >> 0;
  144. currU += (destU - currU) / opts.smoothMove;
  145. currV += (destV - currV) / opts.smoothMove;
  146. zoomDiv.css('background-position', (-(currU >> 0) + 'px ') + (-(currV >> 0) + 'px'));
  147. }
  148. controlTimer = setTimeout(function () {
  149. ctx.controlLoop();
  150. }, 30);
  151. };
  152. this.init2 = function (img, id) {
  153. filesLoaded++;
  154. //console.log(img.src + ' ' + id + ' ' + img.width);
  155. if (id === 1) {
  156. zoomImage = img;
  157. }
  158. //this.images[id] = img;
  159. if (filesLoaded === 2) {
  160. this.init();
  161. }
  162. };
  163. /* Init function start. */
  164. this.init = function () {
  165. // Remove loading message (if present);
  166. $('.cloud-zoom-loading', jWin.parent()).remove();
  167. /* Add a box (mouseTrap) over the small image to trap mouse events.
  168. It has priority over zoom window to avoid issues with inner zoom.
  169. We need the dummy background image as IE does not trap mouse events on
  170. transparent parts of a div.
  171. */
  172. $mouseTrap = jWin.parent().append(format("<div class='mousetrap' style='background-image:url(\""+ opts.transparentImage +"\");z-index:999;position:absolute;width:%0px;height:%1px;left:%2px;top:%3px;\'></div>", sImg.outerWidth(), sImg.outerHeight(), 0, 0)).find(':last');
  173. //////////////////////////////////////////////////////////////////////
  174. /* Do as little as possible in mousemove event to prevent slowdown. */
  175. $mouseTrap.bind('mousemove', this, function (event) {
  176. // Just update the mouse position
  177. mx = event.pageX;
  178. my = event.pageY;
  179. });
  180. //////////////////////////////////////////////////////////////////////
  181. $mouseTrap.bind('mouseleave', this, function (event) {
  182. clearTimeout(controlTimer);
  183. //event.data.removeBits();
  184. if(lens) { lens.fadeOut(299); }
  185. if($tint) { $tint.fadeOut(299); }
  186. if(softFocus) { softFocus.fadeOut(299); }
  187. if(window_width>767){
  188. zoomDiv.fadeOut(300, function () {
  189. ctx.fadedOut();
  190. });
  191. }
  192. return false;
  193. });
  194. //////////////////////////////////////////////////////////////////////
  195. $mouseTrap.bind('mouseenter', this, function (event) {
  196. mx = event.pageX;
  197. my = event.pageY;
  198. zw = event.data;
  199. if (zoomDiv) {
  200. zoomDiv.stop(true, false);
  201. zoomDiv.remove();
  202. }
  203. var xPos = opts.adjustX,
  204. yPos = opts.adjustY;
  205. var siw = sImg.outerWidth();
  206. var sih = sImg.outerHeight();
  207. var w = opts.zoomWidth;
  208. var h = opts.zoomHeight;
  209. if (opts.zoomWidth == 'auto') {
  210. w = siw;
  211. }
  212. if (opts.zoomHeight == 'auto') {
  213. h = sih;
  214. }
  215. //$('#info').text( xPos + ' ' + yPos + ' ' + siw + ' ' + sih );
  216. var appendTo = jWin.parent(); // attach to the wrapper
  217. switch (opts.position) {
  218. case 'top':
  219. yPos -= h; // + opts.adjustY;
  220. break;
  221. case 'right':
  222. xPos += siw; // + opts.adjustX;
  223. break;
  224. case 'bottom':
  225. yPos += sih; // + opts.adjustY;
  226. break;
  227. case 'left':
  228. xPos -= w; // + opts.adjustX;
  229. break;
  230. case 'inside':
  231. w = siw;
  232. h = sih;
  233. break;
  234. // All other values, try and find an id in the dom to attach to.
  235. default:
  236. appendTo = $('#' + opts.position);
  237. // If dom element doesn't exit, just use 'right' position as default.
  238. if (!appendTo.length) {
  239. appendTo = jWin;
  240. xPos += siw; //+ opts.adjustX;
  241. yPos += sih; // + opts.adjustY;
  242. } else {
  243. w = appendTo.innerWidth();
  244. h = appendTo.innerHeight();
  245. }
  246. }
  247. if(window_width>767){
  248. zoomDiv = appendTo.append(format('<div id="cloud-zoom-big" class="cloud-zoom-big" style="display:none;position:absolute;left:%0px;top:%1px;width:%2px;height:%3px;background-image:url(\'%4\');z-index:99;"></div>', xPos, yPos, w, h, zoomImage.src)).find(':last');
  249. }
  250. // Add the title from title tag.
  251. if (sImg.attr('title') && opts.showTitle) {
  252. zoomDiv.append(format('<div class="cloud-zoom-title">%0</div>', sImg.attr('title'))).find(':last').css('opacity', opts.titleOpacity);
  253. }
  254. // Fix ie6 select elements wrong z-index bug. Placing an iFrame over the select element solves the issue...
  255. var browserCheck = /(msie) ([\w.]+)/.exec( navigator.userAgent );
  256. if (browserCheck) {
  257. if ((browserCheck[1] || "") == 'msie' && (browserCheck[2] || "0" ) < 7) {
  258. $ie6Fix = $('<iframe frameborder="0" src="#"></iframe>').css({
  259. position: "absolute",
  260. left: xPos,
  261. top: yPos,
  262. zIndex: 99,
  263. width: w,
  264. height: h
  265. }).insertBefore(zoomDiv);
  266. }
  267. }
  268. if(window_width>767){
  269. zoomDiv.fadeIn(500);
  270. if (lens) {
  271. lens.remove();
  272. lens = null;
  273. } /* Work out size of cursor */
  274. cw = (sImg.outerWidth() / zoomImage.width) * zoomDiv.width();
  275. ch = (sImg.outerHeight() / zoomImage.height) * zoomDiv.height();
  276. // Attach mouse, initially invisible to prevent first frame glitch
  277. lens = jWin.append(format("<div class = 'cloud-zoom-lens' style='display:none;z-index:98;position:absolute;width:%0px;height:%1px;'></div>", cw, ch)).find(':last');
  278. $mouseTrap.css('cursor', lens.css('cursor'));
  279. var noTrans = false;
  280. // Init tint layer if needed. (Not relevant if using inside mode)
  281. if (opts.tint) {
  282. lens.css('background', 'url("' + sImg.attr('src') + '")');
  283. $tint = jWin.append(format('<div style="display:none;position:absolute; left:0px; top:0px; width:%0px; height:%1px; background-color:%2;" />', sImg.outerWidth(), sImg.outerHeight(), opts.tint)).find(':last');
  284. $tint.css('opacity', opts.tintOpacity);
  285. noTrans = true;
  286. $tint.fadeIn(500);
  287. }
  288. if (opts.softFocus) {
  289. lens.css('background', 'url("' + sImg.attr('src') + '")');
  290. softFocus = jWin.append(format('<div style="position:absolute;display:none;top:2px; left:2px; width:%0px; height:%1px;" />', sImg.outerWidth() - 2, sImg.outerHeight() - 2, opts.tint)).find(':last');
  291. softFocus.css('background', 'url("' + sImg.attr('src') + '")');
  292. softFocus.css('opacity', 0.5);
  293. noTrans = true;
  294. softFocus.fadeIn(500);
  295. }
  296. if (!noTrans) {
  297. lens.css('opacity', opts.lensOpacity);
  298. }
  299. if ( opts.position !== 'inside' ) { lens.fadeIn(500); }
  300. // Start processing.
  301. zw.controlLoop();
  302. }
  303. return; // Don't return false here otherwise opera will not detect change of the mouse pointer type.
  304. });
  305. };
  306. img1 = new Image();
  307. $(img1).load(function () {
  308. ctx.init2(this, 0);
  309. });
  310. img1.src = sImg.attr('src');
  311. img2 = new Image();
  312. $(img2).load(function () {
  313. ctx.init2(this, 1);
  314. });
  315. img2.src = jWin.attr('href');
  316. }
  317. $.fn.CloudZoom = function (options) {
  318. // IE6 background image flicker fix
  319. try {
  320. document.execCommand("BackgroundImageCache", false, true);
  321. } catch (e) {}
  322. this.each(function () {
  323. var relOpts, opts;
  324. // Hmm...eval...slap on wrist.
  325. eval('var a = {' + $(this).attr('rel') + '}');
  326. relOpts = a;
  327. if ($(this).is('.cloud-zoom')) {
  328. opts = $.extend({}, $.fn.CloudZoom.defaults, options);
  329. opts = $.extend({}, opts, relOpts);
  330. $(this).css({
  331. 'position': 'relative',
  332. 'display': 'block'
  333. });
  334. $('img', $(this)).css({
  335. 'display': 'block'
  336. });
  337. // Wrap an outer div around the link so we can attach things without them becoming part of the link.
  338. // But not if wrap already exists.
  339. if (!$(this).parent().hasClass('cloud-zoom-wrap') && opts.useWrapper) {
  340. $(this).wrap('<div class="cloud-zoom-wrap"></div>');
  341. }
  342. $(this).data('zoom', new CloudZoom($(this), opts));
  343. } else if ($(this).is('.cloud-zoom-gallery')) {
  344. opts = $.extend({}, relOpts, options);
  345. $(this).data('relOpts', opts);
  346. $(this).bind('click', $(this), function (event) {
  347. var data = event.data.data('relOpts');
  348. // Destroy the previous zoom
  349. $('#' + data.useZoom).data('zoom').destroy();
  350. // Change the biglink to point to the new big image.
  351. $('#' + data.useZoom).attr('href', event.data.attr('href'));
  352. // Change the small image to point to the new small image.
  353. $('#' + data.useZoom + ' img').attr('src', event.data.data('relOpts').smallImage);
  354. // Init a new zoom with the new images.
  355. $('#' + event.data.data('relOpts').useZoom).CloudZoom();
  356. return false;
  357. });
  358. }
  359. });
  360. return this;
  361. };
  362. $.fn.CloudZoom.defaults = {
  363. zoomWidth: 'auto',
  364. zoomHeight: 'auto',
  365. position: 'right',
  366. transparentImage: '.',
  367. useWrapper: true,
  368. tint: false,
  369. tintOpacity: 0.5,
  370. lensOpacity: 0.5,
  371. softFocus: false,
  372. smoothMove: 3,
  373. showTitle: true,
  374. titleOpacity: 0.5,
  375. adjustX: 0,
  376. adjustY: 0
  377. };
  378. })(jQuery);
  379. jQuery(function ($) {
  380. "use strict";
  381. var $mainContainer = $(".container"),
  382. $section = $(".products-list"),
  383. $links = $(".quick-view:not(.fancybox)"),
  384. $view = $(".product-view-ajax"),
  385. $container = $(".product-view-container", $view),
  386. $loader = $(".ajax-loader", $view),
  387. $layar = $(".layar", $view),
  388. $slider;
  389. var initProductView = function ($productView) {
  390. var $slider = $(".flexslider-large", $productView),
  391. $nav = $(".flexslider-thumb", $productView),
  392. $navvertical = $(".flexslider-thumb-vertical", $productView),
  393. $close = $(".close-view", $productView);
  394. if ($productView && $productView.length) $.initSelect($productView.find(".btn-select"));
  395. $navvertical.each(function () {
  396. var jcarousetItemsNumber = $(this).find("ul li").size();
  397. if (jcarousetItemsNumber > 3) {
  398. $(this).flexVSlider({
  399. animation: "slide",
  400. direction: "vertical",
  401. move: 3,
  402. keyboard: false,
  403. controlNav: false,
  404. animationLoop: false,
  405. slideshow: false,
  406. prevText: "",
  407. nextText: ""
  408. })
  409. }
  410. })
  411. $nav.each(function () {
  412. var jcarousetItemsNumber = $(this).find("ul li").size();
  413. if (jcarousetItemsNumber > 3) {
  414. $(this).flexslider({
  415. animation: "slide",
  416. keyboard: false,
  417. controlNav: false,
  418. animationLoop: false,
  419. slideshow: false,
  420. prevText: "",
  421. nextText: "",
  422. itemWidth: 72,
  423. itemMargin: 7
  424. })
  425. }
  426. })
  427. $slider.flexslider({
  428. animation: "slide",
  429. keyboard: false,
  430. controlNav: true,
  431. directionNav: true,
  432. animationLoop: false,
  433. slideshow: false,
  434. prevText: "",
  435. nextText: ""
  436. });
  437. $close.click(function (e) {
  438. e.preventDefault();
  439. $container.slideUp(500, function () {
  440. $container.empty();
  441. $view.hide();
  442. $container.show()
  443. })
  444. })
  445. };
  446. $links.click(function (e) {
  447. if ($(".hidden-xs").is(":visible")) {
  448. e.preventDefault();
  449. var $this = $(this),
  450. url = $this.attr("href");
  451. if ($this.closest(".product-carousel").length > 0) $this.closest(".row").find(".product-view-ajax-container").first().append($view);
  452. else $this.parent().parent().nextAll(".product-view-ajax-container").first().append($view);
  453. $view.show();
  454. $layar.show();
  455. $loader.show();
  456. $.ajax({
  457. url: url,
  458. cache: false,
  459. success: function (data) {
  460. var $data = $(data);
  461. initProductView($data);
  462. $loader.hide();
  463. $layar.hide();
  464. if (!$container.text()) {
  465. $data.hide();
  466. $container.empty().append($data);
  467. $data.slideDown(500)
  468. } else $container.empty().append($data)
  469. },
  470. complete: function () {
  471. if ($(".various").length > 0) $(".various").fancybox({
  472. maxWidth: 800,
  473. maxHeight: 600,
  474. fitToView: false,
  475. width: "70%",
  476. height: "70%",
  477. autoSize: false,
  478. closeClick: false,
  479. openEffect: "none",
  480. closeEffect: "none"
  481. });
  482. console.log("ajax complete");
  483. CloudZoom.quickStart()
  484. },
  485. error: function (jqXHR, textStatus, errorThrown) {
  486. $loader.hide();
  487. $container.html(textStatus)
  488. }
  489. })
  490. }
  491. });
  492. initProductView();
  493. var productCarousel = $(".product-carousel"),
  494. container = $(".container");
  495. if (productCarousel.length > 0) productCarousel.each(function () {
  496. var items = 4,
  497. itemsDesktop = 4,
  498. itemsDesktopSmall = 3,
  499. itemsTablet = 2,
  500. itemsMobile = 1;
  501. if ($("body").hasClass("noresponsive")) {
  502. var items = 4,
  503. itemsDesktop = 4,
  504. itemsDesktopSmall = 4,
  505. itemsTablet = 4,
  506. itemsMobile = 4;
  507. if ($(this).closest("section.col-md-8.col-lg-9").length > 0) var items = 3,
  508. itemsDesktop = 3,
  509. itemsDesktopSmall = 3,
  510. itemsTablet = 3,
  511. itemsMobile = 3;
  512. else if ($(this).closest("section.col-lg-9").length > 0) var items = 3,
  513. itemsDesktop = 3,
  514. itemsDesktopSmall = 3,
  515. itemsTablet = 3,
  516. itemsMobile = 3;
  517. else if ($(this).closest("section.col-sm-12.col-lg-6").length > 0) var items = 2,
  518. itemsDesktop = 2,
  519. itemsDesktopSmall = 2,
  520. itemsTablet = 2,
  521. itemsMobile = 2;
  522. else if ($(this).closest("section.col-lg-6").length > 0) var items = 2,
  523. itemsDesktop = 2,
  524. itemsDesktopSmall = 2,
  525. itemsTablet = 2,
  526. itemsMobile = 12;
  527. else if ($(this).closest("section.col-sm-12.col-lg-3").length > 0) var items = 1,
  528. itemsDesktop = 1,
  529. itemsDesktopSmall = 1,
  530. itemsTablet = 1,
  531. itemsMobile = 1;
  532. else if ($(this).closest("section.col-lg-3").length > 0) var items = 1,
  533. itemsDesktop = 1,
  534. itemsDesktopSmall = 1,
  535. itemsTablet = 1,
  536. itemsMobile = 1;
  537. } else if ($(this).closest("section.col-md-8.col-lg-9").length > 0) var items = 3,
  538. itemsDesktop = 3,
  539. itemsDesktopSmall = 2,
  540. itemsTablet = 2,
  541. itemsMobile = 1;
  542. else if ($(this).closest("section.col-lg-9").length > 0) {var items = 3,
  543. itemsDesktop = 3,
  544. itemsDesktopSmall = 2,
  545. itemsTablet = 2,
  546. itemsMobile = 1;}
  547. else if ($(this).closest("section.col-sm-12.col-lg-6").length > 0) var items = 2,
  548. itemsDesktop = 2,
  549. itemsDesktopSmall = 3,
  550. itemsTablet = 2,
  551. itemsMobile = 1;
  552. else if ($(this).closest("section.col-lg-6").length > 0) var items = 2,
  553. itemsDesktop = 2,
  554. itemsDesktopSmall = 2,
  555. itemsTablet = 2,
  556. itemsMobile = 1;
  557. else if ($(this).closest("section.col-sm-12.col-lg-3").length > 0) var items = 1,
  558. itemsDesktop = 1,
  559. itemsDesktopSmall = 3,
  560. itemsTablet = 2,
  561. itemsMobile = 1;
  562. else if ($(this).closest("section.col-lg-3").length > 0) var items = 1,
  563. itemsDesktop = 1,
  564. itemsDesktopSmall = 2,
  565. itemsTablet = 2,
  566. itemsMobile = 1;
  567. $(this).owlCarousel({
  568. items: items,
  569. itemsDesktop: [1199, itemsDesktop],
  570. itemsDesktopSmall: [980, itemsDesktopSmall],
  571. itemsTablet: [768, itemsTablet],
  572. itemsTabletSmall: false,
  573. itemsMobile: [360, itemsMobile],
  574. navigation: true,
  575. pagination: false,
  576. rewindNav: false,
  577. navigationText: ["", ""],
  578. scrollPerPage: true,
  579. slideSpeed: 500,
  580. beforeInit: function rtlSwapItems(el) {
  581. if ($("body").hasClass("rtl")) el.children().each(function (i, e) {
  582. $(e).parent().prepend($(e))
  583. })
  584. },
  585. afterInit: function afterInit(el) {
  586. if ($("body").hasClass("rtl")) this.jumpTo(1000)
  587. }
  588. })
  589. });
  590. var productsListSmall = $(".products-list-small .slides");
  591. if (productsListSmall.length > 0) {
  592. var items = 12,
  593. itemsDesktop = 12,
  594. itemsDesktopSmall = 8,
  595. itemsTablet = 6,
  596. itemsMobile = 3;
  597. if ($("body").hasClass("noresponsive")) var items = 12,
  598. itemsDesktop = 12,
  599. itemsDesktopSmall = 12,
  600. itemsTablet = 12,
  601. itemsMobile = 12;
  602. productsListSmall.owlCarousel({
  603. items: items,
  604. itemsDesktop: [1199, itemsDesktop],
  605. itemsDesktopSmall: [980, itemsDesktopSmall],
  606. itemsTablet: [768, itemsTablet],
  607. itemsTabletSmall: false,
  608. itemsMobile: [360, itemsMobile],
  609. navigation: true,
  610. pagination: false,
  611. rewindNav: false,
  612. navigationText: ["", ""],
  613. scrollPerPage: true,
  614. slideSpeed: 500,
  615. beforeInit: function rtlSwapItems(el) {
  616. if ($("body").hasClass("rtl")) el.children().each(function (i, e) {
  617. $(e).parent().prepend($(e))
  618. })
  619. },
  620. afterInit: function afterInit(el) {
  621. if ($("body").hasClass("rtl")) this.jumpTo(1000)
  622. }
  623. })
  624. }
  625. var brandsCarousel = $(".brands-carousel ul");
  626. var brandsCarouselMax = 6;
  627. if ($(".content-center .brands-carousel ul").length > 0) { brandsCarouselMax = 4 }
  628. if (brandsCarousel.length > 0){
  629. brandsCarousel.carouFredSel({
  630. responsive: true,
  631. width: '100%',
  632. scroll: 1,
  633. prev: '#brands-carousel-prev',
  634. next: '#brands-carousel-next',
  635. items: {
  636. width: 170,
  637. height: '30%', // optionally resize item-height
  638. visible: {
  639. min: 1,
  640. max: brandsCarouselMax
  641. }
  642. }
  643. });
  644. }
  645. var productWidgets = $(".product-widgets");
  646. if (productWidgets.length > 0) productWidgets.owlCarousel({
  647. items: 1,
  648. navigation: true,
  649. pagination: false,
  650. rewindNav: false,
  651. navigationText: ["", ""],
  652. scrollPerPage: true,
  653. slideSpeed: 300
  654. });
  655. var $contentcenter = $(".content-center"),
  656. $contentaside = $(".content-aside");
  657. if ($(".visible-xs").is(":visible")) $contentcenter.insertBefore($contentaside);
  658. $(window).resize(function () {
  659. var $contentcenter = $(".content-center"),
  660. $contentaside = $(".content-aside");
  661. if ($(".visible-xs").is(":visible")) $contentcenter.insertBefore($contentaside);
  662. else $contentaside.insertBefore($contentcenter)
  663. })
  664. });