$( document ).ready(function() { checkLeftColumn(); $(".titulo_bloque").click(function() { if($(window).width() < 992) $(this).parent().children(".contenido_bloque").toggle(); }); // Solo en version movil if($(window).width() < 700) { // Evento cuando se pulsa el boton de filtros $("#button_show_categories_listing").click(function() { $('.button_show_categories').show("fast"); $( "#box_categories" ).show("fast", function() { $( "#menu-background" ).show(); }); }); // Evento cuando se pulsa el boton de filtros $(search_modal_prefix+"#button_show_filters_listing").click(function() { $(search_modal_prefix+'.button_show_filters').show("fast"); $(search_modal_prefix+"#filtro_" ).show("fast", function() { $(search_modal_prefix+"#menu-background" ).show(); }); }); // Evento cuando se pulsa el boton de filtros $("#button_show_categories_listing.manufacturer").click(function() { $('.button_show_categories.manufacturer').show("fast"); $( "#box_categories_manufacturer" ).show("fast", function() { $( "#menu-background" ).show(); }); }); // Eventyo para cerrar si se toca el boton $(search_modal_prefix+".button_show_filters .close-menu-responsive").click(function() { $(search_modal_prefix+'.button_show_filters').hide("fast"); $(search_modal_prefix+"#filtro_" ).hide("fast", function() { $(search_modal_prefix+"#menu-background" ).hide(); }); }); // Eventyo para cerrar si se toca el boton $(".button_show_categories .close-menu-responsive").click(function() { $('.button_show_categories').hide("fast"); $( "#box_categories" ).hide("fast", function() { $( "#menu-background" ).hide(); }); }); // Eventyo para cerrar si se toca el boton $(".button_show_categories.manufacturer .close-menu-responsive").click(function() { $('.button_show_categories').hide("fast"); $( "#box_categories_manufacturer" ).hide("fast", function() { $( "#menu-background" ).hide(); }); }); // Eventos para cerrar si se toca fuera $(window).click(function() { //Hide the menus if visible $('.button_show_categories').hide("fast"); $( "#box_categories" ).hide("fast"); $( "#box_categories_manufacturer" ).hide("fast"); $(search_modal_prefix+'.button_show_filters').hide("fast"); $(search_modal_prefix+"#filtro_" ).hide("fast"); $(search_modal_prefix+"#menu-background" ).hide(); }); $('#button_show_categories_listing').click(function(event){ event.stopPropagation(); }); $('.button_show_categories').click(function(event){ event.stopPropagation(); }); $('#box_categories').click(function(event){ event.stopPropagation(); }); $(search_modal_prefix+'#button_show_filters_listing').click(function(event){ event.stopPropagation(); }); $(search_modal_prefix+'.button_show_filters').click(function(event){ event.stopPropagation(); }); $(search_modal_prefix+'#filtro_').click(function(event){ event.stopPropagation(); }); $('#box_categories_manufacturer').click(function(event){ event.stopPropagation(); }); // Evento para cuando el scroll llega a los botones de filtro $(window).scroll(function() { if ($(search_modal_prefix+'#preFilterButtons').length && $(search_modal_prefix+'#filters_buttons').length) { var hT = $(search_modal_prefix+'#preFilterButtons').offset().top, hH = $(search_modal_prefix+'#preFilterButtons').outerHeight(), wS = $(this).scrollTop(); if (wS > (hT+hH-133)){ $(search_modal_prefix+'#filters_buttons').css('position', 'fixed'); $(search_modal_prefix+'#filters_buttons').css('top', '133px'); } else { $(search_modal_prefix+'#filters_buttons').css('position', 'relative'); $(search_modal_prefix+'#filters_buttons').css('top', '0px'); } } }); } }); $( window ).resize(function() { checkLeftColumn(); }); // Cambia la posicion de los elementos segun la resolucion function checkLeftColumn() { if($(window).width() > 700) { //$('#Content').insertAfter('#ColumnLeft'); } else { // $('#ColumnLeft').insertAfter('#Content'); } if($(window).width() <= 700) { if(!$('.bloqueProductos').length) $(search_modal_prefix+'#filtro_').hide(); } }