由于项目的需要,俺要做一些页面的转场动画。
即将是移动端,肯定是首先css动画了。
结果确发现,css动画中,如果设置animation-fill-mode: both;在动画结束后无法个性translate3d的值;
起初,以为是项目过于复杂,代码之前造成了相互影响,可事实并非如何。
后来,我便写了个简单demo来测试;
css:
@keyframes slideInRight { 0% { visibility: visible; -webkit-transform: translate3d(100%, 0, 0); transform: translate3d(100%, 0, 0); } 100% { visibility: visible; -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); }}.slideInRight { -webkit-animation-name: slideInRight; animation-name: slideInRight; -webkit-animation-fill-mode: both; animation-fill-mode: both;animation-duration: .35s;}
在css动画结束后,js手动设置translate3d()竟然无效,真是很头疼,即便是在谷歌浏览器也无法设置其值。
无奈,只能在动画结束后再先移除动画样式,但即使是这样,在部分浏览器中也会出现无法更改的情况
1 $('.page').on('webkitAnimationEnd', function (e) {//webkit动画结束隐藏2 $(this).removeClass('animated slideInRight').trans3d(0);3 }, false);
真是头疼。。
--------------------都说海水深,怎抵相思半----------------------------

The article discusses the roles of <head> and <body> tags in HTML, their impact on user experience, and SEO implications. Proper structuring enhances website functionality and search engine optimization.

Article discusses specifying character encoding in HTML, focusing on UTF-8. Main issue: ensuring correct display of text, preventing garbled characters, and enhancing SEO and accessibility.

The article discusses various HTML formatting tags used for structuring and styling web content, emphasizing their effects on text appearance and the importance of semantic tags for accessibility and SEO.

The article discusses the differences between HTML's 'id' and 'class' attributes, focusing on their uniqueness, purpose, CSS syntax, and specificity. It explains how their use impacts webpage styling and functionality, and provides best practices for

The article explains the HTML 'class' attribute's role in grouping elements for styling and JavaScript manipulation, contrasting it with the unique 'id' attribute.

Article discusses HTML list types: ordered (<ol>), unordered (<ul>), and description (<dl>). Focuses on creating and styling lists to enhance website design.

HTML entities are codes used in HTML to display special characters correctly, ensuring proper rendering across browsers and devices.

Collapsing white space optimizes content by reducing file size, enhancing readability, and ensuring consistent formatting across platforms in web and document processing.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
