我试图在达到一定时间后使data-role = page重定向。我要触发定时重定向的页面是系列中的第三页(#tim3),用户只能依次访问。在此示例中,我希望网站重定向到#james1,即到达页面#tim3后10秒,而无需单击任何按钮。多年来一直在指代stackoverflow,但这是我曾经问过的第一个问题,很抱歉,如果我没有提供正确的上下文。
<div id="storyOne">
<div id="tim1" data-role="page" class="ui-content">
<img onclick="location.href='index.html#tim2'" src="img/mainscreenTim@2x.png">
</div>
<div id="tim2" data-role="page" class="fullscreen-bg">
<video id="timVid" webkit-playsinline playsinline autoplay muted class="fullscreen-bg__video">
<source src="media/ExpoStoriesTim.mp4" type="video/mp4">
</video>
</div>
<div id="tim3" data-role="page" class="ui-content">
<h1>This is all the stuff telling you to go to storyvine</h1>
<div class="vidThumb">
Tim Story
</div>
</div><!-- end tim3 -->
</div><!--end storyOne -->
<div id="storyTwo">
<div id="james1" data-role="page" class="ui-content">
this is story2
</div>
</div>
<script>
$("#timVid").bind("ended", function() {
window.location.replace("index.html#tim3");
});
$(document).ready(function() {
window.setInterval(function() {
var timeLeft = $("index.html#tim3").html();
if(parseInt(timeLeft) == 0){
[removed]= ("index.html");
}else{
$("index.html#tim3").html(parseInt(timeLeft)- parseInt(1));
}
}, 10000);
});
</script>