jQuery(function($){ /* var section = $('.deal-card'); var width = section.width(); if (width > 1000) section.addClass('col-md-6'); if (width < 1000) section.addClass('col-md-12'); */ $('#filter').change(function(){ var filter = $('#filter'); $.ajax({ url:filter.attr('action'), data:filter.serialize(), // form data type:filter.attr('method'), // POST beforeSend:function(xhr){ filter.find('button').text('Processing...'); // changing the button label }, success:function(data){ filter.find('button').text('Apply filter'); // changing the button label back $('#response').html(data); // insert data } }); return false; }); $('#filterpost').change(function(){ var filterpost = $('#filterpost'); $.ajax({ url:filterpost.attr('action'), data:filterpost.serialize(), // form data type:filterpost.attr('method'), // POST beforeSend:function(xhr){ filterpost.find('button').text('Processing...'); // changing the button label }, success:function(data){ filterpost.find('button').text('Apply filter'); // changing the button label back $('#responsepost').html(data); // insert data } }); return false; }); $(document).ready(() => { let url = location.href.replace(/\/$/, ""); if (location.hash) { const hash = url.split("#"); $('#deal-brand-tabs a[href="#'+hash[1]+'"]').tab("show"); url = location.href.replace(/\/#/, "#"); history.replaceState(null, null, url); setTimeout(() => { $(window).scrollTop(0); }, 400); } $('a[data-toggle="tab"]').on("click", function() { let newUrl; const hash = $(this).attr("href"); if(hash == "#nav-home") { newUrl = url.split("#")[0]; } else { newUrl = url.split("#")[0] + hash; } newUrl += "/"; history.replaceState(null, null, newUrl); }); }); });