1/* 2 * Custom code goes here. 3 * A template should always ship with an empty custom.js 4 */ 5 6jQuery(document).ready(function ($) { 7 8 $('#siteloader').fadeOut(); 9 $('#spin-wrapper').fadeOut(); 10 11 function adjustFixedHeader() { 12 var headerHeight = $('#header').height(); 13 var navHeightDesktop = $('#header .header-top').height(); 14 var navHeightMobile = $('#header').height(); 15 16 if (window.matchMedia('(max-width: 992px)').matches) { 17 $('.nav-full-width').removeClass('fixed-header'); 18 if ($(window).scrollTop() > navHeightDesktop) { 19 $('.header-top').addClass('fixed-header'); 20 } 21 else { 22 $('.header-top').removeClass('fixed-header'); 23 } 24 } 25 26 if (!window.matchMedia('(max-width: 991px)').matches) { 27 $('.header-top').removeClass('fixed-header'); 28 if ($(window).scrollTop() > navHeightMobile) { 29 $('.nav-full-width').addClass('fixed-header'); 30 } 31 else { 32 $('.nav-full-width').removeClass('fixed-header'); 33 } 34 } 35 } 36 37 var rtlFlag = $('body').hasClass('lang-rtl') ? true : false; 38 39 adjustTopMenu(); 40 41 var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent); 42 if (!isMobile) { 43 if ($(".parallax").length) { 44 $(".parallax").sitManParallex({ invert: false }); 45 }; 46 } else { 47 $(".parallax").sitManParallex({ invert: true }); 48 } 49 50 adjustTopMenu(); 51 adjustFixedHeader(); 52 53 $(window).resize(function () { 54 adjustTopMenu(); 55 adjustFixedHeader(); 56 }); 57 58 //fixed header 59 $(window).scroll(function () { 60 adjustFixedHeader(); 61 }); 62 63 64 $('#search_widget .search-logo').click(function () { 65 $(this).toggleClass('active').parents('#search_widget').find('div').stop(true, true).slideToggle('medium'); 66 /* $(this).toggleClass('active').parents('#search_widget').find('#search').stop(true, true).slideToggle('medium');*/ 67 }); 68 69 $(document).on('click', '.cart-link', function () { 70 $(this).siblings('.cart-dropdown').stop(true, true).slideToggle(); 71 }); 72 73 var list = new Array(); 74 $('.offerstitle').each(function (i, obj) { 75 list.push($(this).html()); 76 }); 77 78 var myoffer = $('.offerstitle').length; 79 if (myoffer != 0) { 80 var typed = new Typed('.typed', { 81 strings: list, 82 typeSpeed: 90, 83 backSpeed: 90, 84 loop: true, 85 rtl: $('body').hasClass('lang-rtl') ? true : false, 86 contentType: 'html', 87 showCursor: false, 88 }); 89 } 90 91 $('.qv-carousel').owlCarousel({ 92 nav: true, 93 margin: 15, 94 loop: true, 95 dots: true, 96 rewind: true, 97 rtl: $('body').hasClass('lang-rtl') ? true : false, 98 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 99 responsive: { 100 0: { 101 items: 2 102 }, 103 443: { 104 items: 3 105 }, 106 544: { 107 items: 4 108 }, 109 768: { 110 items: 3 111 }, 112 992: { 113 items: 3 114 }, 115 1200: { 116 items: 4 117 } 118 } 119 }); 120 121 $('#ishileftsidebarproducts1.owl-carousel').owlCarousel({ 122 loop: false, 123 nav: true, 124 margin: 15, 125 rewind: true, 126 dots: false, 127 rtl: rtlFlag, 128 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 129 responsive: { 130 0: { 131 items: 1 132 }, 133 544: { 134 items: 2 135 }, 136 768: { 137 items: 2 138 }, 139 992: { 140 items: 1 141 }, 142 1200: { 143 items: 1 144 } 145 } 146 });
147 148 $('#ishileftsidebarproducts2.owl-carousel').owlCarousel({ 149 loop: false, 150 nav: true, 151 margin: 15, 152 rewind: true, 153 dots: false, 154 rtl: rtlFlag, 155 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 156 responsive: { 157 0: { 158 items: 1 159 }, 160 544: { 161 items: 2 162 }, 163 768: { 164 items: 2 165 }, 166 992: { 167 items: 1 168 }, 169 1200: { 170 items: 1 171 } 172 } 173 }); 174 175 $('#ishirightsidebarproducts1.owl-carousel').owlCarousel({ 176 loop: false, 177 nav: true, 178 margin: 15, 179 rewind: true, 180 dots: false, 181 rtl: rtlFlag, 182 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 183 responsive: { 184 0: { 185 items: 1 186 }, 187 544: { 188 items: 2 189 }, 190 768: { 191 items: 2 192 }, 193 992: { 194 items: 1 195 }, 196 1200: { 197 items: 1 198 } 199 } 200 }); 201 202 $('#ishirightsidebarproducts2.owl-carousel').owlCarousel({ 203 loop: false, 204 nav: true, 205 margin: 15, 206 rewind: true, 207 dots: false, 208 rtl: rtlFlag, 209 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 210 responsive: { 211 0: { 212 items: 1 213 }, 214 544: { 215 items: 2 216 }, 217 768: { 218 items: 2 219 }, 220 992: { 221 items: 1 222 }, 223 1200: { 224 items: 1 225 } 226 } 227 }); 228 229 $('.ishispecialdealproducts-carousel.owl-carousel').owlCarousel({ 230 loop: false, 231 nav: true, 232 margin: 15, 233 rewind: true, 234 dots: false, 235 rtl: rtlFlag, 236 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 237 responsive: { 238 0: { 239 items: 2 240 }, 241 544: { 242 items: 2 243 }, 244 768: { 245 items: 3 246 }, 247 992: { 248 items: 2 249 }, 250 1200: { 251 items: 1 252 } 253 } 254 }); 255 256 $('#ishispecialdeals-carousel.owl-carousel').owlCarousel({ 257 loop: true, 258 nav: true, 259 rewind: true, 260 dots: false, 261 rtl: rtlFlag, 262 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 263 responsive: { 264 0: { 265 items: 1 266 }, 267 544: { 268 items: 1 269 }, 270 768: { 271 items: 1 272 }, 273 992: { 274 items: 1 275 }, 276 1200: { 277 items: 1 278 } 279 280 } 281 }); 282 283 $('#newproducts-container.owl-carousel').owlCarousel({ 284 loop: false, 285 nav: true, 286 rewind: true, 287 dots: false, 288 rtl: rtlFlag, 289 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 290 responsive: { 291 0: { 292 items: 1 293 }, 294 544: { 295 items: 1 296 }, 297 768: { 298 items: 1 299 }, 300 992: { 301 items: 1 302 }, 303 1200: { 304 items: 1 305 } 306 307 } 308 }); 309 310 $('#ishicategoryblock-carousel').owlCarousel({ 311 loop: false, 312 nav: false, 313 dots: true, 314 rewind: true, 315 autoplay: true, 316 autoplayTimeout: 5000, 317 smartSpeed: 2500, 318 rtl: rtlFlag, 319 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 320 responsive: { 321 0: { 322 items: 1 323 }, 324 544: { 325 items: 1 326 }, 327 768: { 328 items: 2 329 }, 330 992: { 331 items: 3 332 }, 333 1200: { 334 items: 4 335 }, 336 1400: { 337 items: 5 338 } 339 } 340 });
341 342 $('#ishi-product-accessories.owl-carousel').owlCarousel({ 343 loop: false, 344 rewind: true, 345 nav: true, 346 dots: false, 347 rtl: rtlFlag, 348 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 349 responsive: { 350 0: { 351 items: 2 352 }, 353 544: { 354 items: 2 355 }, 356 768: { 357 items: 2 358 }, 359 992: { 360 items: 2 361 }, 362 1200: { 363 items: 3 364 }, 365 1400: { 366 items: 4 367 } 368 } 369 }); 370 371 $('#smartblog-carousel').owlCarousel({ 372 loop: false, 373 rewind: true, 374 dots: false, 375 nav: true, 376 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 377 autoplay: false, 378 rtl: rtlFlag, 379 responsive: { 380 0: { 381 items: 1 382 }, 383 544: { 384 items: 1 385 }, 386 768: { 387 items: 1 388 }, 389 992: { 390 items: 1 391 }, 392 1200: { 393 items: 2 394 } 395 } 396 }); 397 398 $('#manufacturer-carousel').owlCarousel({ 399 loop: true, 400 dots: false, 401 nav: false, 402 autoplay: true, 403 autoplayTimeout: 2000, 404 rtl: rtlFlag, 405 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 406 responsive: { 407 0: { 408 items: 2 409 }, 410 544: { 411 items: 2 412 }, 413 768: { 414 items: 3 415 }, 416 992: { 417 items: 2 418 }, 419 1200: { 420 items: 4 421 }, 422 1400: { 423 items: 5 424 } 425 } 426 }); 427 428 $('#supplier-carousel').owlCarousel({ 429 loop: true, 430 nav: false, 431 autoplay: true, 432 autoplayTimeout: 2000, 433 rtl: rtlFlag, 434 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 435 responsive: { 436 0: { 437 items: 1 438 }, 439 544: { 440 items: 2 441 }, 442 768: { 443 items: 4 444 }, 445 992: { 446 items: 6 447 } 448 } 449 }); 450 451 $('#ishitestimonials-carousel').owlCarousel({ 452 loop: false, 453 rewind: true, 454 nav: true, 455 autoplay: true, 456 rtl: rtlFlag, 457 navText: ["<i class='material-icons'></i>", "<i class='material-icons'></i>"], 458 items: 1 459 }); 460 461 $('.product-image').magnificPopup({ 462 type: 'image', 463 delegate: 'a', 464 gallery: { 465 enabled: true, 466 navigateByImgClick: true 467 } 468 }); 469 470 $('#header .blockcart .product-container').slimScroll({ 471 height: $('#header .blockcart .product-container .product').length > 1 ? '240px' : '100%' 472 }); 473 474 $(window).scroll(function () { 475 if ($(this).scrollTop() > 500) { 476 $('#slidetop').fadeIn(500); 477 } else { 478 $('#slidetop').fadeOut(500); 479 } 480 }); 481 482 $('#slidetop').click(function (e) { 483 e.preventDefault(); 484 $('html, body').animate({ scrollTop: 0 }, 800); 485 }); 486 487 $(".read_comment").click(function (e) { 488 $('html, body').animate({ scrollTop: $("#product-comments-list").offset().top }, 2500); 489 }); 490 491 if ($('#product.page-product').length) { 492 if ($('#product-comments-list-header .grade-stars').length) { 493 $('.product-list-reviews .grade-stars').html($('#product-comments-list-header .grade-stars').html()); 494 } else { 495 $('.product-information .product-list-reviews').hide(); 496 } 497 } 498 499 500 /* =============================== Product Layout JS ===============================*/ 501 var currentLayout = $.totalStorage('productLayout'); 502 if (currentLayout && currentLayout == 'listView') { 503 $('#grid-view').removeClass('checked'); 504 setProductLayout('listView'); 505 } else { 506 setProductLayout('gridView'); 507 } 508 509 $(document).on('click', '#list-view', function (e) { 510 if ($(this).hasClass('checked')) 511 return; 512 513 $('#js-product-list').fadeOut(500, function () { 514 setProductLayout('listView'); 515 }); 516 $('#js-product-list').fadeIn(500); 517 });
518 519 $(document).on('click', '#grid-view', function (e) { 520 if ($(this).hasClass('checked')) 521 return; 522 $('#js-product-list').fadeOut(500, function () { 523 setProductLayout('gridView'); 524 }); 525 $('#js-product-list').fadeIn(500); 526 }); 527 528}); 529 530function setProductLayout(layout) { 531 if (layout == 'listView') { 532 $('#list-view').addClass('checked'); 533 $('#grid-view').removeClass('checked'); 534 $('#js-product-list .products').removeClass('grid'); 535 $('#js-product-list .products').addClass('list'); 536 $('#js-product-list .products article').each(function () { 537 $(this).removeClass('col-xs-6 col-sm-6 col-md-4 col-lg-6 col-xl-4'); 538 $(this).find('.thumbnail-inner').addClass('col-xs-12 col-sm-6 col-md-4 col-lg-4'); 539 $(this).find('.product-description').addClass('col-xs-12 col-sm-6 col-md-8 col-lg-8'); 540 }); 541 $.totalStorage('productLayout', 'listView'); 542 } else { 543 $('#grid-view').addClass('checked'); 544 $('#list-view').removeClass('checked'); 545 $('#js-product-list .products').removeClass('list'); 546 $('#js-product-list .products').addClass('grid'); 547 $('#js-product-list .products article').each(function () { 548 $(this).addClass('col-xs-6 col-sm-6 col-md-4 col-lg-6 col-xl-4'); 549 $(this).find('.thumbnail-inner').removeClass('col-xs-12 col-sm-6 col-md-4 col-lg-4'); 550 $(this).find('.product-description').removeClass('col-xs-12 col-sm-6 col-md-8 col-lg-8'); 551 }); 552 $.totalStorage('productLayout', 'gridView'); 553 } 554} 555 556function adjustTopMenu() { 557 $('#_desktop_top_menu #top-menu > li').each(function (index) { 558 var li = $(this).find('.sub-menu > ul > li').length; 559 switch (li) { 560 case 1: $(this).find('.sub-menu').css('width', '230px'); 561 break; 562 case 2: $(this).find('.sub-menu').css('width', '430px'); 563 break; 564 default: $(this).find('.sub-menu').css('width', '630px'); 565 } 566 }); 567} 568 569
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.