File tree 4 files changed +38
-7
lines changed
examples/httpiancj.github.io-qq
4 files changed +38
-7
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,14 @@ <h2>data-rel</h2>
18
18
< p > 此时,Mobilebone会根据对应< code > page</ code > 页面的前后顺序确定其正向过场还是反向。</ p >
19
19
< h3 > 其他说明</ h3 >
20
20
< ol >
21
+ < li > < code > data-rel="back"</ code > 在以前两种场景都是有返回效果的。
22
+ < pre > <a href="#pageBack" < span style ="color:#cd0000; "> data-rel="back"</ span > > 返回</a> </ pre >
23
+ < pre > <a href="javascript:" < span style ="color:#cd0000; "> data-rel="back"</ span > > 返回</a> </ pre >
24
+ < p > 那它们的差别在什么地方呢?</ p >
25
+ < p > 前者返回具有明确的目的性,知道前往的页面,虽然是返回,但是,< code > history</ code > 依然会push一条访问记录;而没有< code > href</ code > 的返回,也就是后者只会返回上一次的页面,其作用跟下面代码一样:</ p >
26
+ < pre > <a href="javascript:history.back();"> 返回</a> </ pre >
27
+ < p > 真正意义上的浏览器返回,< code > history</ code > 回退至上一个记录,而不是再塞一条。所以,大家需要根据不同的返回场景做不同的处理。</ p >
28
+ </ li >
21
29
< li >
22
30
< code > data-rel</ code > 其实还支持一个值,< code > "external"</ code > . 作用和< code > data-ajax="false"</ code > 一致,感觉有些鸡肋,正犹豫要不要删掉,故没有放在上面讲。
23
31
</ li >
Original file line number Diff line number Diff line change
1
+ <!doctype html>
2
+ < html >
3
+ < head >
4
+ < meta charset ="utf-8 ">
5
+ < meta name ="viewport " content ="width=device-width,initial-scale=1.0,user-scalable=no ">
6
+ < title > 即将前往仿QQ webapp页面...</ title >
7
+ </ head >
8
+
9
+ < body >
10
+ < div id ="pageHome " class ="page ">
11
+ < p > 此示例作者:< a href ="https://github.com/iancj "> iancj</ a > </ p >
12
+ < p > 即将前往仿QQ webapp页面...或直接< a href ="http://iancj.github.io/qq/ "> 点击这里</ a > 。</ p >
13
+ </ div >
14
+ < script >
15
+ setTimeout ( function ( ) {
16
+ location . replace ( "http://iancj.github.io/qq/" ) ;
17
+ } , 3000 ) ;
18
+ </ script >
19
+ </ body >
20
+ </ html >
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " mobilebone" ,
3
- "version" : " 1.1.6 " ,
3
+ "version" : " 1.1.7 " ,
4
4
"description" : " Bone main for mobile web APP with a sigle page mode." ,
5
5
"main" : " src/mobilebone.js" ,
6
6
"directories" : {
Original file line number Diff line number Diff line change 27
27
var isSimple = / ^ .[ ^ : # \[ \. , ] * $ /
28
28
29
29
// Is it suppory history API
30
- var supportHistory = "pushState" in history &&
31
- "replaceState" in history &&
32
- // When running inside a FF iframe, calling replaceState causes an error
33
- ! ( window . navigator . userAgent . indexOf ( "Firefox" ) >= 0 && window . top !== window ) &&
34
- ( window . navigator . userAgent . search ( / C r i O S / ) === - 1 ) ;
30
+ var supportHistory = "pushState" in history && "replaceState" in history ;
35
31
36
32
Mobilebone . support = supportHistory ;
37
33
44
40
*
45
41
* @type string
46
42
**/
47
- Mobilebone . VERSION = '1.1.6 ' ;
43
+ Mobilebone . VERSION = '1.1.7 ' ;
48
44
49
45
/**
50
46
* Whether catch attribute of href from element with tag 'a'
100
96
**/
101
97
Mobilebone . pushStateEnabled = true ;
102
98
99
+ if ( // When running inside a FF iframe, calling replaceState causes an error. So set 'pushStateEnabled = false'
100
+ ( window . navigator . userAgent . indexOf ( "Firefox" ) >= 0 && window . top !== window )
101
+ ) {
102
+ Mobilebone . pushStateEnabled = false ;
103
+ }
104
+
105
+
103
106
/**
104
107
* Function for transition
105
108
* In most cases, you are unnecessary to use this function , unlike Mobilebone.createPage
You can’t perform that action at this time.
0 commit comments