Skip to content

Commit 56fbfe3

Browse files
author
zhangxinxu
committed
fix onpagefirstinto excute repeatedly bug
fix onpagefirstinto excute repeatedly bug
1 parent 5ec43c1 commit 56fbfe3

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

src/mobilebone.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282

283283
// delete page with same id when options.remove !== false
284284
var pageid = options.id || pageInto.id;
285-
285+
286286
if (options.remove !== false && store[pageid] && store[pageid] != pageInto && store[pageid].parentElement) {
287287
store[pageid].parentElement.removeChild(store[pageid]);
288288
delete store[pageid];
@@ -1080,6 +1080,7 @@
10801080
// hash ↔ id
10811081
if (page_in) {
10821082
Mobilebone.transition(page_in, page_out, Mobilebone.isBack(page_in, page_out), {
1083+
id: hash, // fix issue #83
10831084
history: false,
10841085
remove: false
10851086
});

test/ajax-html/b.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</head>
66

77
<body>
8-
<div class="page out">
8+
<div class="page out" data-onpagefirstinto="page_b_first">
99
<ul>
1010
<li><a href="c.html">此为b页面,点击加载c页面</a></li>
1111
</ul>

test/ajax-html/c.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<div class="page out">
99
<ul>
1010
<li><a href="#pageHome" data-rel="back">c页面,直接刷新,浏览器返回</a></li>
11+
<li><a href="javascript:" data-rel="back">直接返回b页面</a></li>
1112
</ul>
1213
</div>
1314
</body>

test/ajax-html/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
show.innerHTML = should.innerHTML;
5959
}
6060
};
61+
62+
var page_b_first = function() {
63+
// console.log("first?");
64+
};
6165
</script>
6266
</body>
6367
</html>

0 commit comments

Comments
 (0)