- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
我在背景图像上使用 CSS3 变换以在悬停时放大。
我已经在最新的 Opera、Safari 和 Firefox 浏览器中进行了测试,并且运行良好且流畅,但是在 Chrome 中,过渡非常不稳定。
这是链接,将鼠标悬停在社交图标上以了解我的意思... http://www.media-flare.com/pins/ - 我注意到当您将浏览器的大小调整为移动 View 时,情况会变得更糟。
我在这里做了一个 jsfiddle 版本并放慢了转换速度,因为它更难看到。
http://jsfiddle.net/wsgfz/1/ - 这在 chrome 和 firefox 中看起来很不稳定,在 safari 和 opera 中很流畅。
我能做些什么来使过渡更顺利吗?
如果你无法查看jsfiddle,这里是代码
.social {
position: relative;
list-style:none;
}
.social > li > a {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
color: transparent;
}
.social > li > a {
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
color: transparent;
}
.fbook, .twit, .tmblr, .pntrst, .insta {
background: url(http://placehold.it/350x150) center center;
width: 78px;
height: 90px;
background-size: cover;
float: left;
margin: 30px;
-webkit-transition: all 0.8s ease;
-moz-transition: all 0.8s ease;
transition: all 0.8s ease;
}
.fbook {background-position: 0 0}
.twit {background-position: -78px 0}
.tmblr {background-position: -156px 0}
.pntrst {background-position: -232px 0}
.insta {background-position: -310px 0}
.fbook:hover, .twit:hover, .tmblr:hover, .pntrst:hover, .insta:hover {
-webkit-transform: scale(1.5);
-moz-transform: scale(1.5);
transform: scale(1.5);
}
<ul class="social">
<li><a href="" class="fbook">Facebook</a></li>
<li><a href="" class="twit">Twitter</a></li>
<li><a href="" class="tmblr">Tumbler</a></li>
<li><a href="" class="pntrst">Pinterest</a></li>
<li><a href="" class="insta">Instagram</a></li>
<li><a href="" class="rss">RSS</a></li>
</ul>
最佳答案
2017 年更新
作为对@Matt Coughlin 帖子的回应,原生支持动画的浏览器现在在它们自己的线程上呈现 CSS 和 JS 动画....
CSS-based animations, and Web Animations where supported natively, are typically handled on a thread known as the "compositor thread." This is different from the browser's "main thread", where styling, layout, painting, and JavaScript are executed. This means that if the browser is running some expensive tasks on the main thread, these animations can keep going without being interrupted.
https://developers.google.com/web/fundamentals/design-and-ui/animations/animations-and-performance
此开发人员文档还支持@user1467267 当前接受的答案...
Where you can, you should avoid animating properties that trigger layout or paint. For most modern browsers, this means limiting animations to opacity or transform, both of which the browser can highly optimize; it doesn’t matter if the animation is handled by JavaScript or CSS.
该文档还建议为您要设置动画的属性实现 will-change
属性的使用,以便浏览器可以对这些属性执行额外的优化。根据我的个人经验,这似乎只在 chrome 中的不透明度和变换中才明显。
element{
will-change: transform, opacity;
}
关于css - Chrome 中的生涩 CSS 变换过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15605731/
大家好,我使用的是翻译动画,如下所示: 现在它工作正常,除了它在动画时似乎闪烁/ SCSS ?这是标准吗? 我确实有 6 个不同的 View 同时被激活,这是原因吗? 这是我设置动画的方式: //
我正在将我的表格从 XML 提要加载到数组中,然后创建单元格,如下面的代码所示。加载时有时会非常不稳定。我以为那只是我滚动时下载的图像,但我删除了它们进行测试,有时它仍然不稳定。无法弄清楚我做错了什么
我一直在使用 scale() 属性,直到几周前它都运行良好。浏览器更新后,现在我看到一个不稳定/跳跃的动画,有人可以指出我的问题到底出在哪里吗? 请看下面的 jsFiddle ;在翻转中,ICON(显
这是网站 --> http://giantsofafrica.org/camps/top-50-camp/ 每当我在这个网站上使用 fancybox 时,都会出现这种奇怪的、不稳定的、滑动的 Acti
我正在使用 XMLParser 为 ListView 获取带有日期的 XML。解析器将日期发送到 LazyAdapter,然后由 LazyAdapter 构建列表。 当我在我的应用程序中滚动时,Lis
我正在尝试将图像动画化到 Canvas 上。 在 html 文件中我有 dog.png,它是一个 Image Sprites。 在 CSS 文件中: #dog{ object-positio
我正在尝试使用 Bootstrap 4 从我的导航中获得一个很好的幻灯片,但它真的很生涩。这是我的代码: var videoWidth = 1280; var video = $(".vid
我有一个 UITableView,其中包含多个带有标题的部分,可折叠/展开。还有一个带有自定义 UIView 的 tableHeaderView。 使用自定义部分标题 UIView 和自定义 UITa
在我的 vmware、主机 linux 上安装 maverick 后,鼠标不稳定,我该如何解决? 最佳答案 这是我尝试过的累积解决方案,我认为更新 VMWARE 工具对我有用。 可能的解决方案:1.
我在使用 UITableView 时遇到了这个问题,tableView 的 cells 高度不同,自动布局约束设置不当。当您向下滚动到 tableView 的底部并加载更多数据(无论使用 reload
我在 GLSurfaceView 上使用 GLES 2.0 用 Java 制作了一个小型 2D 游戏。但我在性能方面遇到了一些问题。我在 OnDrawFrame 函数中完成了所有游戏状态的渲染和更
我是一名优秀的程序员,十分优秀!