Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个使用 .animate() 滑出到网页上的导航菜单。在浏览器大小低于 1000 像素之前,它看起来很棒。如果视口小于1000px,有没有办法告诉jquery不要使用我创建的函数,所以我可以让css接管?
我不认为您可以在 CSS 中停用 jQuery,但在制作动画之前,您可以这样做:
if($(window).width() > 1000) { //animate }
我不知道是否有一个很好的小解决方案,但是如果窗口宽度大于 1000 像素,您可以检查窗口宽度,然后加载脚本。
if($(window).width() > 1000) { $.getScript // http://api.jquery.com/jQuery.getScript/ }