我从事这项工作已经很久了,我觉得这是我的最后选择,我在html网页上有幻灯片放映,并且基本上可以通过滚动浏览直至结尾。本质上,我希望用户能够返回到其仪表板,并在单击以返回到幻灯片显示时重新加载他们所在的页面...
在页面顶部,我有这个:
[
{
"name": "server1",
"context": "/project/build",
"host": "host",
"username": "username",
"password": "password",
"remotePath": "/remote/project/build"
},
{
"name": "server2",
"context": "/project/src",
"host": "host",
"username": "username",
"password": "password",
"remotePath": "/remote/project/src"
}
]
我实际上是说将cookie设置为1(幻灯片放映的第一页= 1,然后在下一节的上方,如下所示:
<input type="hidden" value="{{$date[$key]}}" name="dates[]">
在每张幻灯片上,我都有以下内容,只是更改了slide = number:
<?php
if (!isset($_COOKIE['PageNo'])){
setcookie("PageNo", 1, time() + (86400 * 30), "/"); // 86400 = 1 day, so set the cookie for a month long period
}
?>
因此,我要说的是,如果cookie大于或等于2,则转至no'x'页,否则转至第1页。但是,它一直在做的事情是使我不断回到第1页。救命!!我将cookie设置错了吗?
更新:在浏览了一些幻灯片之后,cookie应该更改为5,但是仍然是1?
显示页面HTML的更新代码:
<?php
if($_COOKIE['PageNo'] >= 2)
{
?>
<script>
window.location.replace("<?php echo "istudy_university.php#slide=".$_COOKIE['PageNo']; ?> ");
</script>
<?php
}
else
{
?>
<script>
window.location.replace("istudy_university.php#slide=1");
</script>
<?php
}
?>
答案 0 :(得分:1)
在仪表板和幻灯片页面中都包含jQuery库。 在幻灯片页面中包含Scrollify库
在信息中心页面中,将ID添加到幻灯片页面导航链接,例如:
<a id="home" href="#">Slides</a>
按如下所示修改幻灯片页面中的部分:
示例:
<section class="slides aligncenter" id="b">
<span class="background light" style="background-image: url('istudy_slides_images/mountain.jpg')" /></span>
<div class="wrap" id="slide=2">
<blockquote class="quote">
<p class>"No one can create negativity or stress within you. Only you can do that by virtue of how you process your world"</p>
<p><cite>Wayne Dyer</cite></p>
</blockquote>
</div>
</section>
<!-- SLIDE 3 -->
<section class="slides bg-slide3" id="c">
<div class="wrap size-80" id="slide=3">
<h3 class="title stessAnx"><strong> Stress & Anxiety</strong></h3><br>
<p>Stress and anxiety are common experiences of students in higher education.<br>This module will introduce you to evidence based techniques for managing stress and anxiety based upon cognitive behavioural therapy (CBT).</p>
</section>
**每个部分的ID均以'b','c'等给出。
**两个部分都包含一个通用的类名-'slides'。
在幻灯片页面的页脚中添加以下JavaScript代码。
$.scrollify({
section: ".slides", //Rename the class name with the common class name that you gave for the sections
after: function() {
localStorage.setItem('currentPage', $.scrollify.current()[0].id)
}
});
在仪表板页面中,将以下JavaScript代码添加到页脚的末尾:
<script>
if(localStorage.getItem('currentPage') != ''){
var newUrl = 'scroll.html#'+localStorage.getItem('currentPage');
$("#home").attr("href", newUrl);
}
</script>