我使用太多的jQuery?我什么时候过马路? [英] Am I using too much jQuery? When am I crossing the line?

查看:123
本文介绍了我使用太多的jQuery?我什么时候过马路?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我发现自己使用jQuery和JavaScript很多,经常做与使用CSS之前相同的事情。



例如,我交替表行颜色或使用JavaScript / jQuery创建按钮和链接悬停效果。这是可以接受的吗?



所以真正的问题是:
当我使用太多的jQuery?

解决方案

如果您使用 - bobince


Lately I found myself using jQuery and JavaScript a lot, often to do the same things that I did before using CSS.

For example, I alternate table rows color or create buttons and links hover effects using JavaScript/jQuery. Is this acceptable? Or should I keep using CSS for these kinds of things?

So the real question is: When I'm using too much jQuery? How can I understand when I'm crossing the line?

解决方案

You're crossing the line if you're using jQuery to do things that can be done easily without jQuery. jQuery's purpose is to make life easier, but it shouldn't be at the expense of compatibility or usability.

jQuery most certainly shouldn't be used as a replacement for CSS -- think of the users who have JavaScript disabled.

I know this image is overused, but someone had to throw it in here:

Image Credit - bobince.

这篇关于我使用太多的jQuery?我什么时候过马路?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆