[英]jQuery Mobile causing CSS3 animations to refire on panel show
I am using jQuery Mobile to create a sidebar panel: 我正在使用jQuery Mobile创建侧边栏面板:
http://demos.jquerymobile.com/1.4.0/panel-fixed/ http://demos.jquerymobile.com/1.4.0/panel-fixed/
I have CSS3 animations in the body of my page ( ui-content
), which fire on page load: 我的页面正文(
ui-content
)中有CSS3动画,这些动画会在页面加载时触发:
h1.page-title{
-webkit-animation: fade-in 1s linear;
animation: fade-in 1s linear;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
Everything works fine, with the exception that when I click the link to show the panel, the animations refire again (just one time). 一切正常,但当我单击链接以显示面板时,动画再次重新触发(仅一次)。 Can anyone think of what's causing this?
谁能想到这是什么原因?
The page-title
class is unique and not referenced by jQuery mobile in anyway. page-title
类是唯一的,无论如何jQuery Mobile都不会引用它。 I can only think that its simulating a page refresh, but then if the link is clicked twice it doesn't refire again. 我只能认为它模拟了页面刷新,但是如果两次单击链接,它就不会再次触发。
Per Omar's comments, this works well: 根据Omar的评论,这很好用:
Wrap content div in
<div class="ui-panel-wrapper">
.将内容div包装在
<div class="ui-panel-wrapper">
。 When opening panel for the first time, it wraps content div in a div with the aforementioned class.首次打开面板时,它将内容div包装到具有上述类的div中。 This happens only for
data-display
push and reveal , but not overlay .这仅在
data-display
推送和显示时发生 ,而在overlay上不发生。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.