jquery mobile 多个页面间切换时,遇到页面内容不变的情况,首先检查data-role="page"的id,确保id不同。在不禁用ajax的情况下,id相同,jqm不会发起新的请求,而是直接调用缓存。
jquery mobile 开启页面缩放
在jquery mobile中页面缩放默认是关闭的。要开始缩放功能,只需在header或footer标签添加data-disable-page-zoom=false属性即可。
<div data-role="header|footer" data-disable-page-zoom="false">
注:开启缩放时,data-role=header|footer中都不能有data-position="fixed"属性。
CSS3旋转动画
鼠标滑过b标签360度旋转
a:hover b{
animation:articl 4s infinite linear;
-webkit-animation:articl 4s infinite linear;
-moz-animation:articl 4s infinite linear;
-ms-animation:articl 4s infinite linear;
}
@keyframes myrole{
0%{transform:rotate(0deg);}
50%{transform:rotate(180deg);}
100%{transform:rotate(360deg);}
}
@-webkit-keyframes articl{
0%{-webkit-transform:rotate(0deg);}
50%{-webkit-transform:rotate(180deg);}
100%{-webkit-transform:rotate(360deg);}
}
@-moz-keyframes articl{
0%{-webkit-transform:rotate(0deg);}
50%{-webkit-transform:rotate(180deg);}
100%{-webkit-transform:rotate(360deg);}
}
@-ms-keyframes articl{
0%{-webkit-transform:rotate(0deg);}
50%{-webkit-transform:rotate(180deg);}
100%{-webkit-transform:rotate(360deg);}
}
jquery mobile转跳页面时闪动问题的解决
<a href="url" data-transiation="slide">文本</a>
slide转跳时当前页面滚动条会跳到页面顶端
slidefade不会出现这种问题
以下CSS解决进入目标页面后闪一下的问题,效果还不错
slide转跳时当前页面滚动条会跳到页面顶端
slidefade不会出现这种问题
以下CSS解决进入目标页面后闪一下的问题,效果还不错
.ui-page {
backface-visibility:hidden;
-webkit-backface-visibility:hidden; /* Chrome 和 Safari */
-moz-backface-visibility:hidden; /* Firefox */
-ms-backface-visibility:hidden; /* Internet Explorer */
}
jquery mobile 禁用ajax
局部禁用ajax,只需在a标签上添加 data-ajax="false" 或 rel="external" 站外链接)
全局禁止ajax,需要在jquery.js之后、jquery.mobile-1.4.5.js引用之前添加:
<script>$(document).ready(function(){jQuery.mobile.ajaxEnabled = false;});</script>
jquery mobile pageinit等事件多次执行的解决
如果从页面A到B再返回A时,页面A中的pageinit、pageshow等事件会执行多次,解决方法是给当前页面的page(data-role='page')绑定一个变量。
$(document).on('pageinit', '#pageid', function(){
if(!$(this).data('loaded')){
$(this).data('loaded', true);
alert(0);
};
});
jquery mobile 1.4+ 调用和关闭loading
$.mobile.loading('show', {
text: '加载中……', //加载器中显示的文字
textVisible: false, //是否显示文字
theme: 'a', //加载器主题样式a-e
textonly: false, //是否只显示文字
html: '' //要显示的html内容,如图片等
});
$.mobile.loading('hide');
ASP生成utf-8编码的文本文件
直接调用fso.OpenTextFile方法生成的文本文件为ANSI编码,要生成utf-8编码的文本文件需要用到Adodb.Stream组件(主要用于生成utf-8编码的html文件)
Sub toTxt(ByVal f, ByVal s)
Dim adoStream, fso
Set fso=Server.CreateObject("Scripting.FileSystemObject")
If InStr(f, "/")>0 Then
If Not fso.FolderExists(Server.MapPath(Left(f, InStrRev(f, "/")))) Then
Set fso=Nothing
Exit Sub
End If
End If
Set adoStream = Server.CreateObject("ADODB.Stream")
If Err.Number=-2147221005 Then Exit Sub '不支持Adodb.Stream组件
With adoStream
.Type = 2
.Open
.Charset = "utf-8"
.Position = .Size
.WriteText= s
.SaveToFile Server.MapPath(f), 2
.Close
End With
Set adoStream = Nothing
End Sub
jquery.transit.js插件-CSS3过渡效果插件
http://code.ciaoca.com/jquery/transit/
http://github.com/rstacruz/jquery.transit
CSS3之animation
@keyframes 自定义名称 {
0% {
Properties:Properties value;
}
Percentage {
Properties:Properties value;
}
100% {
Properties:Properties value;
}
}
Percentage的单位是%,不可省略
浏览器兼容性写法:
@-webkit-keyframes
@-moz-keyframes
@-o-keyframes
@keyframes
例:
<style>
@-webkit-keyframes wobble{
0% {
margin-left: 100px;
background: green;
}
40% {
margin-left: 150px;
background: orange;
}
60% {
margin-left: 75px;
background: blue;
}
100% {
margin-left: 100px;
background: red;
}
}
.demo1{
width: 50px;
height: 50px;
margin-left: 100px;
background: blue;
-webkit-animation-name:'wobble';/*动画属性名,也就是我们前面keyframes定义的动画名*/
-webkit-animation-duration: 10s;/*动画持续时间*/
-webkit-animation-timing-function: ease-in-out; /*动画频率,和transition-timing-function是一样的*/
-webkit-animation-delay: 2s;/*动画延迟时间*/
-webkit-animation-iteration-count: 10;/*定义循环次数,infinite为无限次*/
-webkit-animation-direction: alternate;/*定义动画方式*/
/*-webkit-animation:wobble 10s ease-in-out 2s 10 alternate; 合到一行的写法*/
}
</style>
<div class="demo1"></div>
animation:[<animation-name> || <animation-duration> || <animation-timing-function> || <animation-delay> || <animation-iteration-count> || <animation-direction>] [, [<animation-name> || <animation-duration> || <animation-timing-function> || <animation-delay> || <animation-iteration-count> || <animation-direction>] ]*
也可以每个属性单独写:
1、animation-name: none 或 Keyframes创建的动画名(多个动画名用逗号分隔)
2、animation-duration: time 动画播放持续时长,多个用逗号分隔,单位s、ms
3、animation-timing-function 变化速率:linear、ease、ease-in、ease-out、ease-in-out
4、animation-delay 延时
5、animation-iteration-count 动画循环次数,默认为1,infinite无限次
6、animation-direction 动画播放方向,默认normal每次循环向前;alternate偶数次向前,奇数次反向播放
7、animation-play-state 动画播放状态,默认running,paused暂停。此属性基本不用来源:http://www.w3cplus.com/content/css3-animation
