$(function(){ // fade effect when changing sections $('a[data-fade]').click(function(e){ $('').prependto('body').fadein(function(){ return true; }); }) // selectmenu if ($('.select-wrapper').size () > 0) { $('.select-wrapper:not(.wide) select').selectmenu({ transferclasses: true, menuwidth: 154 }); $('.select-wrapper.wide select').selectmenu({ transferclasses: true, menuwidth: 214 }); } // nav effect $('.site-nav li:not(.active)').hover(function(){ $(this).children('span').stop(true, true).fadein(); $(this).children('a').stop(true, true).animate({ color: '#fff' }); }, function(){ $(this).children('span').stop(true, true).fadeout(); $(this).children('a').stop(true, true).animate({ color: '#1ba7da' }); }); // home if ($('#home-slider').size() > 0) { $('#home-slider').plusslider({ autoplay: true, displaytime: 4000, createpagination: false, keyboardnavigation: false, slidertype: 'fader', pauseonhover: false }); $('').appendto('.plusslider .arrow'); } $('.jcarousel-prev, .plusslider .arrow.prev').hover(function(){ if($(this).attr('disabled') != 'disabled') { $(this).children().stop(true, true).animate({'left' : -10}); } }, function(){ $(this).children().stop(true, true).animate({'left' : 0}); }); $('.jcarousel-next, .plusslider .arrow.next').hover(function(){ if($(this).attr('disabled') != 'disabled') { $(this).children().stop(true, true).animate({'left' : 10}); } }, function(){ $(this).children().stop(true, true).animate({'left' : 0}); }); // products if ($('.products-category:not(.single)').size() > 0) { $('.products-category').jcarousel({ buttonnexthtml: 'next', buttonprevhtml: 'previous', scroll: 4 }); optionindex = $('select.products-categories option:selected').index(); $('.jcarousel-container:eq(' + optionindex + ')').addclass('active'); $('.jcarousel-container:not(.active)').hide(); $('select.products-categories').change(function(){ optionindex = $(this).children(':selected').index(); $('.jcarousel-container.active').fadeout(function(){ $(this).removeclass('active'); $('.jcarousel-container:eq(' + optionindex + ')').fadein(function(){ $(this).addclass('active'); }); }); }); } $('.products-item').mouseenter(function(){ $item = $(this); $item.find('.product-image-hover').stop(true, true).fadein(); }).mouseleave(function(){ $item = $(this); $item.find('.product-image-hover').stop(true, true).fadeout(); }); $('.products-item').find('.product-info-icon, .product-image-hover').click(function(){ $container = $(this).closest('.products-item'); $icon = $container.find('.product-info-icon'); if(!$icon.hasclass('active')) { $icon.stop(true, true).animate({ 'bottom' : 62 }).addclass('active').animate({ 'bottom' : 24 }); if ($container.parent().hasclass('single')) { contentheight = 72; } else { contentheight = 106; } $container.find('.product-info-wrapper').children('.product-info').stop(true, true).animate({ 'height' : contentheight }); } else { if ($(this).hasclass('product-info-icon')) { $icon.stop(true, true).animate({ 'bottom' : 62 }).removeclass('active').animate({ 'bottom' : 30 }); $container.find('.product-info-wrapper').children('.product-info').stop(true, true).animate({ 'height' : 8 }); } } }); $('.select-product').click(function(e){ $product = $(this).closest('.products-item'); //console.log($product); $.cookie('selected_category', $('.selectmenu.products-categories').val(), '/'); $.cookie('selected_product', $product.data('product-id'), '/'); //console.log($.cookie('selected_category')); //console.log($.cookie('selected_product')); //return false; }); // services if ($('.services-list').size() > 0) { $('.services-list').accordion({ autoheight: false, event:"mouseover", create: function (event, ui) { $('.services-list li:first r_bt').addclass('active'); }, changestart: function (event, ui) { ui.oldheader.children('span').animate({ 'left' : 561 }, function () { $(this).removeclass('active').animate({ 'left' : 600 }); }); ui.newheader.children('span').stop(true, true).animate({ 'left' : 561 }, function () { $(this).addclass('active').animate({ 'left' : 600 }); //$(this).stop(true, true).animate({ 'left' : 600 }); }); return true; }, change: function (event, ui) { return true; } }); } // contact if ($('#map').size() > 0) { mapinit(); } $('.contact-form .select-wrapper.product, .contact-form .products-category, .contact-form .products-item').hide(); toggleproductcategory(true); $('select.products-category-selector').change(function(){ toggleproductcategory(false); }); $('select.products-item-selector').change(function(){ toggleproductitem(); }); $('#loading-mask').fadeout('slow', function(){ $(this).remove(); }); }); function toggleproductcategory (onload) { // tomo el indice de la categoria seleccionada categoryselectedindex = $('select.products-category-selector :selected').index(); $('.select-wrapper.product.active').hide().removeclass('active'); $('.select-wrapper.product:eq(' + categoryselectedindex + ')').show().addclass('active'); $('.products-category.active').fadeout().removeclass('active').children('li.active').fadeout().removeclass('active'); $('.products-category:eq(' + (categoryselectedindex - 1) + ')').fadein(function(){ $(this).addclass('active'); toggleproductitem(); }); return true; } function toggleproductitem (onload) { categoryselectedindex = $('.products-category-selector :selected').index(); productselectedindex = $('.select-wrapper.product.active select :selected').index(); if (productselectedindex > 0) { $('.products-category.active .products-item.active').fadeout().removeclass('active'); $('.products-category.active .products-item:eq(' + (productselectedindex - 1) + ')').fadein().addclass('active'); } } function mapinit () { var latlng = new google.maps.latlng(-34.462737, -58.524939); var myoptions = { zoom: 16, center: latlng, maptypeid: google.maps.maptypeid.roadmap }; var map = new google.maps.map(document.getelementbyid("map"), myoptions); var image = 'img/map_marker.png'; var beachmarker = new google.maps.marker({ position: latlng, map: map, icon: image }); }