/** * @package Joomla.Site * @subpackage Templates.protostar * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt * @since 3.2 */ jQuery.noConflict(); (function($) { $(document).ready(function() { $("#menu-left-open").click(function(){ $('body').addClass("open-left"); }); $("#block, #menu-left .ico-times").click(function(){ $('body').removeClass("open-left").removeClass("open-right"); }); $("#menu-right-open").click(function(){ $('body').addClass("open-right"); }); if ($('#jv-icon-search').length) { $('#jv-icon-search').bind("click",function(){ $(this).parents(".jv-search-wrapper").toggleClass("open"); }); }; $('*[rel=tooltip], .tooltips').tooltip(); if (getCookie("color")) { $('.jv-logo a').html('JV Fashion') }; // Style layout $('a[class*="color-"]').click(function(event){ var strColor = $(this).attr("class").substr(6); setCookie("color",strColor,1); location.reload(); event.preventDefault(); }); $('a[class*="dir-"]').click(function(event){ var strDir = $(this).attr("class").substr(4); setCookie("direction",strDir,1); location.reload(); event.preventDefault(); }); var strLayout = $("body").attr("data-layout"); $('a[class*="layout-"]').click(function(event){ strLayout = $(this).attr("class").substr(7); setCookie("layoutCt",strLayout,1); if (strLayout=="wide") { $("body").removeClass("boxed").addClass("wide"); }else { $("body").removeClass("wide").addClass("boxed"); } $(".jvresslide > .resbon").height($(".jvresslide .items li.active").height()); event.preventDefault(); }); $(".bg-"+ $("body").attr("data-background")).addClass("active"); $('a[class*="bg-"]').parent("li").addClass("li-left"); $('a[class*="bg-"]').click(function(event){ strBackground = $(this).attr("class").substr(3); setCookie("background",strBackground,1); $('a[class*="bg-"]').removeClass("active"); $(this).addClass("active"); $("body").removeClass() $("body").addClass(strLayout+" "+strBackground); event.preventDefault(); }); function setCookie(cname,cvalue,exdays){ var d = new Date(); d.setTime(d.getTime()+(exdays*24*60*60*1000)); var expires = "expires="+d.toGMTString(); document.cookie = cname + "=" + cvalue + "; " + expires + ";path=/"; } function getCookie(cname){ var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i' }); btnNext = new Element('a', { 'class':'jv-arrow-carousel jv-arrow-next', html: '' }); btnPrev.inject(document.id("jv-wrapper").getElement('.jv-latest .hikashop_products')); btnNext.inject(document.id("jv-wrapper").getElement('.jv-latest .hikashop_products')); $('.jv-latest .row').on('jcarousel:create jcarousel:reload', function() { var element = $(this), width = element.innerWidth(); if (width > 992) { width = width / 5; } else if (width > 760) { width = width / 4; }else if (width > 300) { width = width / 2; } element.jcarousel('items').css('width', width + 'px'); }) .jcarousel({wrap: 'circular'}); $('.jv-arrow-prev').on('jcarouselcontrol:active', function() { $(this).removeClass('inactive'); }) .on('jcarouselcontrol:inactive', function() { $(this).addClass('inactive'); }) .jcarouselControl({ target: '-=1' }); $('.jv-arrow-next').on('jcarouselcontrol:active', function() { $(this).removeClass('inactive'); }) .on('jcarouselcontrol:inactive', function() { $(this).addClass('inactive'); }).jcarouselControl({ target: '+=1' }); }; // Brands slider if ($('.jv-brands .thumbnails').length) { $('.jv-brands .row') .on('jcarousel:create jcarousel:reload', function() { var element = $(this), width = element.innerWidth(); if (width > 992) { width = width / 5; } else if (width > 760) { width = width / 4; }else if (width > 400) { width = width / 2; } element.jcarousel('items').css('width', width + 'px'); }) .jcarousel({wrap: 'circular'}) .jcarouselAutoscroll({ interval: 3000, target: '+=1', autostart: true }); }; slideThumb(); $('.hasTooltip').tooltip({"html": true,"container": "body"}); if ($('a.accordion-toggle').length) { $('a.accordion-toggle').attr("data-toggle","").attr("data-parent","").parents('.accordion-group').find('.accordion-body').removeClass("in"); }; if ($('.accordion-body ul').length) { $('.accordion-body ul').parents('.accordion-group').find('a.accordion-toggle').addClass("show"); }; $('a.accordion-toggle').click(function(e){ $(this).toggleClass("collapsed").parents('.accordion-group').find('.accordion-body').toggleClass("in"); e.preventDefault(); }); //Characteristics $(".hikashop_product_characteristics_table select").change( function() { slideThumb(); }); $(".back-top").hide(); // fade in .back-top $(window).scroll(function () { if ($(this).scrollTop() > 10) { $('.back-top').fadeIn(); } else { $('.back-top').fadeOut(); } if ($(this).scrollTop() > 61) { $('.jv-main-nav-inner').addClass("up"); } else { $('.jv-main-nav-inner').removeClass("up"); } }); // scroll body to 0px on click $('.back-top').click(function (){ $('body,html').animate({scrollTop: 0}, 800); return false; }); }) function slideThumb(){ // thumbnails slide if ($('.jv-slider').length) { var widthCheck = 992, verticalFlg = $(window).width() > widthCheck; $('.jv-slider').jcarousel({ vertical: verticalFlg }); jQuery(window).resize(function() { var flg = ($(window).width() > widthCheck); if (verticalFlg != flg) { verticalFlg = flg; $('.jv-slider').clone(); $('.jv-slider').jcarousel({ vertical: verticalFlg }); } }); // Control carousel $('.jv-slider-control-prev').on('jcarouselcontrol:active', function() { $(this).removeClass('inactive'); }) .on('jcarouselcontrol:inactive', function() { $(this).addClass('inactive'); }).jcarouselControl({ target: '-=1' }); $('.jv-slider-control-next').on('jcarouselcontrol:active', function() { $(this).removeClass('inactive'); }) .on('jcarouselcontrol:inactive', function() { $(this).addClass('inactive'); }).jcarouselControl({ target: '+=1' }); }; } })(jQuery);