How can I tell javascript to execute after max-width
I want to execute below JavaScript only if width is set to 600px or above. How can I put max-width condition?
$(function() { $('#nav li a').bind('click',function(event){ var $anchor = $(this); $('html, body').stop().animate({ scrollTop: $($anchor.attr('href')).offset().top }, 1500,'easeInOutExpo'); event.preventDefault(); }); });
Answers
If the viewport width, you'd do something like this inside the click callback.
if ($(window).width() < 600) { return; }