require(['jquery', 'domReady!'], function ($) { storeLocatorTabs(); $(window).resize(function() { storeLocatorTabs(); }); function storeLocatorTabs() { if ($(document).width() < 768) { jQuery('.-map').hide(); jQuery('.buttons-tabs').show(); jQuery('.amlocator-store-list').show(); jQuery('.buttons-tabs .left-button').addClass('has-active'); jQuery('.buttons-tabs .left-button').click(function(){ if(jQuery('.-map').css('display') == 'block') { jQuery('.amlocator-store-list').show(); jQuery('.-map').hide(); jQuery(this).addClass('has-active') jQuery ('.buttons-tabs .right-button').removeClass('has-active'); } }); jQuery('.buttons-tabs .right-button').click(function(){ if(jQuery('.amlocator-store-list').css('display') == 'block') { jQuery('.-map').show(); jQuery('.amlocator-store-list').hide(); jQuery(this).addClass('has-active') jQuery ('.buttons-tabs .left-button').removeClass('has-active'); } }); }else { jQuery('.-map').show(); jQuery('.amlocator-store-list').show(); jQuery('.buttons-tabs').hide(); } } });