TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Better to use Javascript or CSS

4 点作者 dillon超过 14 年前
I have a lot of animations to fulfill on my website, right now I'm doing pure CSS for these animations. Is it better to use CSS or is it better to use Jquery?

3 条评论

karlclement超过 14 年前
Hello there,<p>I would have to agree with symmet, you need both. This way if a user doesn't have a recent version of Firefox, Google Chrome, Safari or Opera you can have jQuery to fall back on.<p>-You can use browser detection to conditionally enable jQuery scripts on page load. You can use Javascript/jQuery or a server-side script to detect exactly which browser is loading the page.<p>-You can also check out <a href="http://www.modernizr.com/" rel="nofollow">http://www.modernizr.com/</a>. It adds classes to the html element which allow you to target specific browser functionality in your stylesheet.<p>Let me know if you need any help with that,<p>Good luck!<p>Karl
评论 #2141810 未加载
symmet超过 14 年前
My approach is to do everything in CSS animations for browsers that support it, and then fall back to jQuery animations for those that don't.<p>CSS animations can take advantage of hardware graphics acceleration and they render very nicely on mobile browsers.<p>So, my answer is: both.
jet3june超过 14 年前
Both and several other javascript frameworks