$(document).ready(function(){ // IE cleartype fix $(".futuris").ieffembedfix(); // navigation $('.nav li').hover(function() { $(this).addClass('js-active'); }, function() { $(this).removeClass('js-active'); }); $('#header .sub-nav ul li').hover( function () { $(this).children('div').fadeIn(); if ($.browser.msie && $.browser.version.substr(0,1)<9) { $('.sorting select').css('visibility','hidden'); $('html').css('overflow-x','hidden'); }; var navWidth = $('#header .sub-nav').width(); var catWidth = $(this).children('.categories').width(); var navItemPos = $(this).position(); var navItemPosMath = navItemPos.left; var difWidth = navWidth - navItemPosMath; if (catWidth >= difWidth) { $(this).css('position','static'); $(this).children('.categories').css({'right':'9px','top':'31px'}); } else { $(this).children('.categories').css({'left':'-1px','top':'30px'}); $(this).css('position','relative'); }; }, function () { $(this).children('div').hide(); if ($.browser.msie && $.browser.version.substr(0,1)<9) { $('.sorting select').css('visibility','visible'); $('html').css('overflow-x','auto'); }; } ); $('#header td:last-child').addClass('last'); $('#header .categories').hover( function () {$(this).parent('li').addClass('hover');}, function () {$(this).parent('li').removeClass('hover');} ); $('#header .close').click(function () { $(this).parent('div').slideUp('fast'); return false; }); // switcher $('.switcher li').hover(function() { $(this).addClass('js-active'); }, function() { $(this).removeClass('js-active'); }); // carousel jQuery('#brands-carousel').jcarousel(); jQuery('#responses-carousel').jcarousel({scroll: 1}); // $('.promo-cat-list>div').addClass("stop"); // $('.promo-cat-list').addClass("stop"); $('#product-colors').jcarousel({ vertical: true }); // main page promo box $(".promo-desc-with-img").not(".promo-desc-with-img:first").hide(); // tabs and vertical carousel equal heights var tabBoxHeight = $(".tabbed-content-inside").height() -40; $(".jcarousel-skin-colors .jcarousel-container-vertical,.jcarousel-skin-colors .jcarousel-clip-vertical").css("height",tabBoxHeight); function highlight(carousel, obejctli,liindex,listate){ $('.jcarousel-control span:nth-child('+ liindex +')').attr("class","active"); }; function removehighlight(carousel, obejctli,liindex,listate){ $('.jcarousel-control span:nth-child('+ liindex +')').removeAttr("class","active"); }; // function mycarousel_initCallback(carousel) { $('.jcarousel-control span').bind('click', function() { carousel.scroll($.jcarousel.intval($(this).text())); $(this).addClass('active'); $(this).nextAll('span').removeClass('active'); $(this).prevAll('span').removeClass('active'); return false; }); }; $("#product-carousel").jcarousel({ scroll: 1, initCallback: mycarousel_initCallback, itemVisibleInCallback: highlight, itemVisibleOutCallback: removehighlight }); var jcarouselItems = $("#product-carousel .jcarousel-item").size(); if (jcarouselItems == 1) { $("#product-carousel .jcarousel-next,#product-carousel .jcarousel-prev").hide(); }; // quick search $('.navigation .search .text').focus(function() { if (this.value == this.defaultValue){ this.value = ''; } if(this.value != this.defaultValue){ this.select(); } }); $('.navigation .search .text').blur(function() { if ($.trim(this.value) == ''){ this.value = (this.defaultValue ? this.defaultValue : ''); } }); // sidebar menu $('.toggle-icon').click(function () { $(this).toggleClass('toggle-icon-expanded'); $(this).next('a').next('ul').slideToggle('fast'); return false; }); $('.toggle-link').click(function () { $(this).next('ul').slideToggle('fast'); $(this).prev('a').toggleClass('toggle-icon-expanded'); return false; }); // sorting menu $('.sorting > ul > li a').click(function () { $(this).next('ul').slideToggle('fast'); $(this).parent('li').nextAll('li').children('ul').hide(); $(this).parent('li').prevAll('li').children('ul').hide(); return false }); // zebra table $('.zebra tr:odd').addClass('odd'); // order table $('.order tbody tr:eq(0) td').addClass('noborder'); // input incrementing decrementing $(".quantity").append('
+
-
'); $(".button").click(function() { var $button = $(this); var oldValue = $button.parent().find("input").val(); if ($button.text() == "+") { var newVal = parseFloat(oldValue) + 1; // AJAX save would go here } else { // Don't allow decrementing below zero if (oldValue >= 1) { var newVal = parseFloat(oldValue) - 1; // AJAX save would go here } } $button.parent().find("input").val(newVal); $button.parent().find("input").keyup(); }); //styled input elements $('input.radio').customInput(); $("a.ancLinks").click(function () { elementClick = $(this).attr("href"); destination = $(elementClick).offset().top; $("html").animate({ scrollTop: destination}, 1100 ); return false; }); });