AF3 reload, and then, history broken
GloriaCHL opened this issue · 5 comments
I use href="#content" in a page, and when I reload this page, the link couldn't go to #content. The page will change to the panel which I set data-selected default. How can I solve this problem?
Did you set the loadDefaultHash property?
$.afui.loadDefaultHash=true;
Thanks for your answer :-D. But, I'm sorry, I mean that, the url hash is currect. It's still "#content". But the active page which I see is the default page.
@GloriaCHL without a demo, I cannot provide help.
You are right. Here's my code:
javascript:
<script>
$.afui.useOSThemes=false;
$.afui.loadDefaultHash=true;
$.afui.autoLaunch=false;
$(document).ready(function(){
$.afui.launch();
});
//if($.os.ios)
$.afui.animateHeader(true);
</script>
HTML:
<div class="view" id="mainview">
<header>
<h1>What</h1>
<a data-transition="up-reveal" style="float: right;" class="nav-aside-toggle" href="#Four">
toggle
</a>
</header>
<div class="pages">
<div data-left-drawer="left" class="panel" id="One" data-title="One" data-selected="true">One</div>
<div data-left-drawer="left" class="panel" id="Two" data-title="Two">Two</div>
<div class="panel" id="Three" data-title="Three">Three</div>
</div>
<footer>
<a href="#One" class="icon home" data-transition="slide">One</a>
<a href="#Two" class="icon basket" data-transition="slide">Two</a>
<a href="#Three" class="icon check" data-transition="up-reveal">Three</a>
</footer>
</div>
<div class="view" id="touchView">
<header>
<a href="#One" data-transition="up-reveal:dismiss" class="backLink pull-left">back</a>
<h1></h1>
</header>
<div class="pages">
<div class="panel" data-title="Four" id="Four">Four</div>
</div>
</div>
I start from the One page, click the footer tab to the Two page, then click the toggle link in header to open the Four page, then click the Four page head link to go back. Then click the footer tab Three to go to the Three page.And then, the problem is coming: I click the footer tab to go to Two page but the content is still Three page content.And when I click backButton two times to back to the Two page, the content is nothing and I found a "activeDiv" class added to the Two page panel.
@GloriaCHL - can you please post a zip somewhere so I can also see all the JS you are using?