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;
}

Need Your Help

Telerik Treelist NeedDataSource doesn't load data

asp.net telerik

I'm trying to load treelist, everything works well but i always see "No Records To Display".

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.