**If statement in jQuery example:** if (n < 2) { $("body").css("background", "green"); } **I noticed your if statement is missing curly brackets `{ }` so try** (function ($) { $(document).ready(function() { $("#second-column").on("swipe",function(){ if($(window).width()<=900) { $("#nice-menu-1>li>ul").css("display: block; visibility: visible;"); } }); }); })(jQuery);