add full screen scroll

This commit is contained in:
jack 2018-02-04 16:20:05 +08:00
parent eeefbcf837
commit f4d732e40f
7 changed files with 1240 additions and 284 deletions

View File

@ -6,264 +6,275 @@
$this->headLink()->appendStylesheet('/static-sanji/css/index.css');
$this->headLink()->appendStylesheet('/static-sanji/js/Swiper-4.1.0/swiper-4.1.0.min.css');
?>
<div class="swiper-container banner">
<div class="swiper-wrapper">
<?php foreach($this->news as $k=>$v) { ?>
<?php
$description = "";
if (mb_strlen($v['description'])>100)
{
$description = mb_substr($v['description'],0,100,'utf-8').'...';
}else{
$description = $v['description'];
}
?>
<div class="swiper-slide" style="background:url('<?php echo $v['image']; ?>') no-repeat center;background-size:cover">
<span class="cdate">[<?php echo date("Y-m-d",strtotime($v['ts_published'])) ?>]</span>
<h2 class="btitle"><a href="<?php echo $v['url']; ?>"><?php echo $v['title']; ?></a></h2>
<h4 class="bstitle"><?php echo $description; ?></h4>
</div>
<?php } ?>
</div>
<div class="direction">
<div class="swiper-button-prev c-prev"></div>
<div class="swiper-button-next c-next"></div>
</div>
</div>
<div class="container topic">
<div class="row">
<span class="all"><a href="">全部 》</a></span>
<h1 class="data">专题数据</h1>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<h3 class="text-center">黑河生态水文遥感试验HiWATER</h3>
<div>
<div class="col-md-4 text-center data-image">
<img src="/static-sanji/images/index/data01.jpg">
</div>
<div class="col-md-8 data-wrapper">
<p class="heihe-desc">黑河流域生态-水文过程综合遥感观测联合试验简称“黑河生态水文遥感试验”英文名称“Heihe Watershed Allied Telemetry Experimental Research,简称HiWATER“由国家自然科学基金委员会重大研究计划”黑河流域生态-水文过程集成研究“(以下加成黑河计划)和中国科学院”西部行动计划“联合发起组织, 以黑河流域发起组织以黑河流域已建立的观测系统以及2007~2009年开展的”黑河综合遥感联合试验“成果为基础联合多科学、多机构、多项目的科研人</p>
</div>
</div>
</div>
<div class="item">
<h3 class="text-center">黑河生态水文遥感试验HiWATER</h3>
<div>
<div class="col-md-4 text-center data-image">
<img src="/static-sanji/images/index/data01.jpg">
</div>
<div class="col-md-8 data-wrapper">
<p class="heihe-desc">黑河流域生态-水文过程综合遥感观测联合试验简称“黑河生态水文遥感试验”英文名称“Heihe Watershed Allied Telemetry Experimental Research,简称HiWATER“由国家自然科学基金委员会重大研究计划”黑河流域生态-水文过程集成研究“(以下加成黑河计划)和中国科学院”西部行动计划“联合发起组织, 以黑河流域发起组织以黑河流域已建立的观测系统以及2007~2009年开展的”黑河综合遥感联合试验“成果为基础联合多科学、多机构、多项目的科研人</p>
</div>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 hot-data">
<p class="data-title">
<em class="text-left"><span class="glyphicon glyphicon-play"></span>在线下载热门数据</em>
<span class="data-more"><a href="/data">更多 > ></a></span>
</p>
<ul>
<?php foreach($this->mdtop as $i=>$md) : ?>
<li>
<a href="/data/<?php echo $md->uuid; ?>"><?php echo $md->title; ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="col-xs-12 col-sm-6 down_right hot-data">
<p class="data-title">
<em class="text-left"><span class="glyphicon glyphicon-play"></span>离线申请热门数据</em>
<span class="data-more"><a href="/data">更多 > ></a></span>
</p>
<ul>
<?php foreach($this->offlinemdtop as $i=>$md) : ?>
<li>
<a href="/data/<?php echo $md->uuid; ?>"><?php echo $md->title; ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<div class="container news">
<div class="row">
<div class="col-xs-12"><span class="all"><a href="">全部 》</a></span></div>
<div class="col-xs-12"><h1>新闻</h1></div>
<div class="col-xs-6 news-con">
<?php for($i = 1; $i <= 3; $i++){ ?>
<div class="news-wrapper">
<h5><a href="<?= $this->list_news[$i]['url'] ?>"><?= $this->list_news[$i]['title'] ?></a></h5>
<p><?php
$description = "";
if (mb_strlen($this->list_news[$i]['description'])>160)
{
$description = mb_substr($this->list_news[$i]['description'],0,160,'utf-8').'...';
}else{
$description = $this->list_news[$i]['description'];
}
echo $description; ?>
</p>
</div>
<?php } ?>
</div>
<div class="col-xs-6 news-con">
<?php for($i = 4; $i <= 6; $i++){ ?>
<div class="news-wrapper">
<h5><a href="<?= $this->list_news[$i]['url'] ?>"><?= $this->list_news[$i]['title'] ?></a></h5>
<p><?php
$description = "";
if (mb_strlen($this->list_news[$i]['description'])>100)
{
$description = mb_substr($this->list_news[$i]['description'],0,100,'utf-8').'...';
}else{
$description = $this->list_news[$i]['description'];
}
echo $description; ?>
</p>
</div>
<?php } ?>
</div>
</div>
</div>
<div class="container news">
<div class="row clear">
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<span class="all"><a href="">全部 》</a></span>
<h3 id="help"><a href="">帮助</a></h3>
</div>
<div class="col-md-6">
<span class="hicon contact"></span>
<h4>联系我们</h4>
<p>中国西部环境与生态科学数据中心</p>
<p>中国科学院寒区环境与工程研究院 6#1102</p>
<p>E-mail:westdc@lzb.ac.cn</p>
<p>电话:+86-931-4967287</p>
<p>邮编730000</p>
</div>
<div class="col-md-6">
<span class="hicon data-server"></span>
<h4>数据服务</h4>
<p>最近20条离线数据服务记录共5742</p>
<p><a href="">如何申请数据</a></p>
<p><a href="">如何发布数局</a></p>
</div>
<div class="col-md-6">
<span class="hicon statistics"></span>
<h4>统计</h4>
<ul>
<li>
元数据 &nbsp;<span><?php echo $this->metanum; ?></span>
</li>
<li>
在线数据 &nbsp;<span><?php echo number_format($this->onlinesize/1000,2,'.',''); ?></span>GB
</li>
<li>
总数据 &nbsp;<span><?php echo number_format(($this->onlinesize+$this->offlinesize)/1000,2,'.',''); ?></span>GB
</li>
<li>
总注册用户 &nbsp;<span><?php echo $this->usernum; ?></span>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-6 help-wrapper">
<dl class="help">
<dd><a></a></dd>
<dd><a href="/data/request">如何申请数据</a></dd>
<dd><a href="/data/submit">如何提交数据</a></dd>
<dd><a href="">[2014-05-15] Data Citation Help</a></dd>
<dt>本文介绍如何引用数据</dt>
<dd><a href="">[2014-05-15] Data Citation Help</a></dd>
<dd><a href="">[2014-05-15] Data Citation Help</a></dd>
<dd><a href="">[2014-05-15] Data Citation Help</a></dd>
<dt>简要介绍在黑河计划中如何通过科学评审系统提高元数据的质量</dt>
<dd><a href="">[2014-05-15] Data Citation Help</a></dd>
<button id="help-btn">帮助</button>
</dl>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-xs-12">
<span class="all"><a href="">全部</a></span>
<h1>合作单位</h1>
</div>
</div>
<div class="swiper-container cooperation">
<section class="panel home" data-section-name="首页">
<div class="swiper-container banner">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
<?php foreach($this->news as $k=>$v) { ?>
<?php
$description = "";
if (mb_strlen($v['description'])>100)
{
$description = mb_substr($v['description'],0,100,'utf-8').'...';
}else{
$description = $v['description'];
}
?>
<div class="swiper-slide" style="background:url('<?php echo $v['image']; ?>') no-repeat center;background-size:cover">
<span class="cdate">[<?php echo date("Y-m-d",strtotime($v['ts_published'])) ?>]</span>
<h2 class="btitle"><a href="<?php echo $v['url']; ?>"><?php echo $v['title']; ?></a></h2>
<h4 class="bstitle"><?php echo $description; ?></h4>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
</div>
<div class="swiper-slide">
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
<?php } ?>
</div>
<div class="direction">
<div class="swiper-button-prev c-prev"></div>
<div class="swiper-button-next c-next"></div>
</div>
</div>
</section>
<section class="panel panel1" data-section-name="数据共享">
<div class="container topic">
<div class="row">
<span class="all"><a href="">全部 》</a></span>
<h1 class="data">专题数据</h1>
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<h3 class="text-center">黑河生态水文遥感试验HiWATER</h3>
<div>
<div class="col-md-4 text-center data-image">
<img src="/static-sanji/images/index/data01.jpg">
</div>
<div class="col-md-8 data-wrapper">
<p class="heihe-desc">黑河流域生态-水文过程综合遥感观测联合试验简称“黑河生态水文遥感试验”英文名称“Heihe Watershed Allied Telemetry Experimental Research,简称HiWATER“由国家自然科学基金委员会重大研究计划”黑河流域生态-水文过程集成研究“(以下加成黑河计划)和中国科学院”西部行动计划“联合发起组织, 以黑河流域发起组织以黑河流域已建立的观测系统以及2007~2009年开展的”黑河综合遥感联合试验“成果为基础联合多科学、多机构、多项目的科研人</p>
</div>
</div>
</div>
<div class="item">
<h3 class="text-center">黑河生态水文遥感试验HiWATER</h3>
<div>
<div class="col-md-4 text-center data-image">
<img src="/static-sanji/images/index/data01.jpg">
</div>
<div class="col-md-8 data-wrapper">
<p class="heihe-desc">黑河流域生态-水文过程综合遥感观测联合试验简称“黑河生态水文遥感试验”英文名称“Heihe Watershed Allied Telemetry Experimental Research,简称HiWATER“由国家自然科学基金委员会重大研究计划”黑河流域生态-水文过程集成研究“(以下加成黑河计划)和中国科学院”西部行动计划“联合发起组织, 以黑河流域发起组织以黑河流域已建立的观测系统以及2007~2009年开展的”黑河综合遥感联合试验“成果为基础联合多科学、多机构、多项目的科研人</p>
</div>
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-sm-6 hot-data">
<p class="data-title">
<em class="text-left"><span class="glyphicon glyphicon-play"></span>在线下载热门数据</em>
<span class="data-more"><a href="/data">更多 > ></a></span>
</p>
<ul>
<?php foreach($this->mdtop as $i=>$md) : ?>
<li>
<a href="/data/<?php echo $md->uuid; ?>"><?php echo $md->title; ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
<div class="col-xs-12 col-sm-6 down_right hot-data">
<p class="data-title">
<em class="text-left"><span class="glyphicon glyphicon-play"></span>离线申请热门数据</em>
<span class="data-more"><a href="/data">更多 > ></a></span>
</p>
<ul>
<?php foreach($this->offlinemdtop as $i=>$md) : ?>
<li>
<a href="/data/<?php echo $md->uuid; ?>"><?php echo $md->title; ?></a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
<div class="swiper-button-prev"><span class="glyphicon glyphicon-chevron-left"></span></div>
<div class="swiper-button-next"><span class="glyphicon glyphicon-chevron-right"></span></div>
</div>
</div>
</section>
<section class="panel panel2" data-section-name="新闻">
<div class="container news">
<div class="row">
<div class="col-xs-12"><span class="all"><a href="">全部 》</a></span></div>
<div class="col-xs-12"><h1>新闻</h1></div>
<div class="col-xs-6 news-con">
<?php for($i = 1; $i <= 3; $i++){ ?>
<div class="news-wrapper">
<h5><a href="<?= $this->list_news[$i]['url'] ?>"><?= $this->list_news[$i]['title'] ?></a></h5>
<p><?php
$description = "";
if (mb_strlen($this->list_news[$i]['description'])>160)
{
$description = mb_substr($this->list_news[$i]['description'],0,160,'utf-8').'...';
}else{
$description = $this->list_news[$i]['description'];
}
echo $description; ?>
</p>
</div>
<?php } ?>
</div>
<div class="col-xs-6 news-con">
<?php for($i = 4; $i <= 6; $i++){ ?>
<div class="news-wrapper">
<h5><a href="<?= $this->list_news[$i]['url'] ?>"><?= $this->list_news[$i]['title'] ?></a></h5>
<p><?php
$description = "";
if (mb_strlen($this->list_news[$i]['description'])>100)
{
$description = mb_substr($this->list_news[$i]['description'],0,100,'utf-8').'...';
}else{
$description = $this->list_news[$i]['description'];
}
echo $description; ?>
</p>
</div>
<?php } ?>
</div>
</div>
</div>
</section>
<section class="panel panel3" data-section-name="帮助">
<div class="container news">
<div class="row clear">
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<span class="all"><a href="">全部 》</a></span>
<h3 id="help"><a href="">帮助</a></h3>
</div>
<div class="col-md-6">
<span class="hicon contact"></span>
<h4>联系我们</h4>
<p>中国西部环境与生态科学数据中心</p>
<p>中国科学院寒区环境与工程研究院 6#1102</p>
<p>E-mail:westdc@lzb.ac.cn</p>
<p>电话:+86-931-4967287</p>
<p>邮编730000</p>
</div>
<div class="col-md-6">
<span class="hicon data-server"></span>
<h4>数据服务</h4>
<p>最近20条离线数据服务记录共5742</p>
<p><a href="">如何申请数据</a></p>
<p><a href="">如何发布数局</a></p>
</div>
<div class="col-md-6">
<span class="hicon statistics"></span>
<h4>统计</h4>
<ul>
<li>
元数据 &nbsp;<span><?php echo $this->metanum; ?></span>
</li>
<li>
在线数据 &nbsp;<span><?php echo number_format($this->onlinesize/1000,2,'.',''); ?></span>GB
</li>
<li>
总数据 &nbsp;<span><?php echo number_format(($this->onlinesize+$this->offlinesize)/1000,2,'.',''); ?></span>GB
</li>
<li>
总注册用户 &nbsp;<span><?php echo $this->usernum; ?></span>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-6 help-wrapper">
<dl class="help">
<dd><a></a></dd>
<dd><a href="/data/request">如何申请数据</a></dd>
<dd><a href="/data/submit">如何提交数据</a></dd>
<dd><a href="">[2014-05-15] Data Citation Help</a></dd>
<dt>本文介绍如何引用数据</dt>
<dd><a href="">[2014-05-15] Data Citation Help</a></dd>
<dd><a href="">[2014-05-15] Data Citation Help</a></dd>
<dd><a href="">[2014-05-15] Data Citation Help</a></dd>
<dt>简要介绍在黑河计划中如何通过科学评审系统提高元数据的质量</dt>
<dd><a href="">[2014-05-15] Data Citation Help</a></dd>
<button id="help-btn">帮助</button>
</dl>
</div>
</div>
</div>
</section>
<section class="panel panel4" data-section-name="合作单位">
<div class="container">
<div class="row">
<div class="col-xs-12">
<span class="all"><a href="">全部</a></span>
<h1>合作单位</h1>
</div>
</div>
<div class="swiper-container cooperation">
<div class="swiper-wrapper">
<div class="swiper-slide">
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
</div>
<div class="swiper-slide">
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
<div class="col-md-3">
<p>华东师范大学</p>
<p>华东师范大学</p>
</div>
</div>
</div>
<div class="swiper-button-prev"><span class="glyphicon glyphicon-chevron-left"></span></div>
<div class="swiper-button-next"><span class="glyphicon glyphicon-chevron-right"></span></div>
</div>
</div>
</section>
<script src="/static-sanji/js/Swiper-4.1.0/swiper-4.1.0.min.js"></script>
<script src="/static-sanji/js/bootstrap.min.js"></script>
<script src="/static-sanji/js/index.js"></script>
<script src="/static-sanji/js/index.js"></script>
<script src="/static-sanji/js/jquery.scrollify.js"></script>

View File

@ -1,5 +1,5 @@
<hr>
<footer>
<footer id="layout-page-footer">
<hr>
<p class="text-center">©寒区旱区科学数据中心 2006-2014 | <a class="footer-link" href="/about/contact">联系我们</a> | <a class="footer-link" href="/about/terms">使用条款和免费申明 </a> | <a class="footer-link" href="http://www.miibeian.gov.cn" target="_blank">陇ICP备05000491号</a></p>
</footer>
<?php if(!empty($this->pageID)) {?>

View File

@ -1,4 +1,4 @@
<div class="container">
<div class="container" id="layout-page-header">
<div class="row">
<div class="col-xs-12">
<img class="logo" src="/static-sanji/images/index/logo.jpg">

View File

@ -17,12 +17,10 @@
<link rel="alternate" type="application/rss+xml" title="WestDC RSS Feed" href="/data/feed" />
</head>
<body>
<div>
<?= $this->render('sanji-header.phtml') ?>
<!--<div class="breadcrumb"><?= $this->breadcrumb() ?> </div>-->
<?= $this->layout()->content ?>
<?= $this->render('sanji-footer.phtml') ?>
</div>
</body>
<script>setPage();</script>
</html>

View File

@ -24,6 +24,12 @@ h2.btitle {
margin-top: 2%;
font-size: 34px;
}
h2.btitle a{
color: black;
}
h2.btitle a:hover{
color: black;
}
h4.bstitle {
font-size: 24px;
font-weight: 600;
@ -63,7 +69,6 @@ span.cdate {
/* 专题数据*/
.all{
display: inline-block;
margin-top:70px;
margin-bottom: 30px;
}
.all a{
@ -161,12 +166,6 @@ h1{
.news-wrapper a{
color:#333;
}
.news{
margin-top: 80px;
}
.news .all{
margin-top: 25px;
}
.news .hicon{
display: inline-block;
width:40px;
@ -261,3 +260,64 @@ h1{
font-size: 25px;
color:#ccc;
}
.pagination {
position:fixed;
right:20px;
top: 50%;
transform: translateY(-50%);
font-size:1.4em;
z-index: 10;
}
.pagination a {
display:block;
height:20px;
margin-bottom:5px;
color: #0e90d2;
position:relative;
padding:4px;
}
.pagination a.active{
background: none;
color: black;
}
.pagination a.active:after {
box-shadow:inset 0 0 0 5px;
}
.pagination a .hover-text {
font-size:12px;
position:absolute;
right:15px;
top:7px;
opacity:0;
-webkit-transition: opacity 0.5s ease;
transition: opacity 0.5s ease;
padding-right: 15px;
background: none;
color: black;
}
.pagination a:hover .hover-text {
opacity: 1;
background: none;
color: black;
}
.pagination a:after {
-webkit-transition:box-shadow 0.5s ease;
transition:box-shadow 0.5s ease;
width:10px;
height:10px;
display: block;
border:1px solid black;
border-radius:50%;
content:'';
position: absolute;
margin:auto;
top:0;
right:4px;
bottom:0;
}

View File

@ -1,20 +1,64 @@
var mySwiper = new Swiper ('.swiper-container', {
direction: 'horizontal',
loop: true,
// 如果需要分页器
pagination: {
el: '.swiper-pagination',
},
// 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
// 如果需要滚动条
scrollbar: {
el: '.swiper-scrollbar',
},
})
$(function() {
var mySwiper = new Swiper ('.swiper-container', {
direction: 'horizontal',
loop: true,
// 如果需要分页器
pagination: {
el: '.swiper-pagination'
},
// 如果需要前进后退按钮
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev'
},
// 如果需要滚动条
scrollbar: {
el: '.swiper-scrollbar'
}
});
$.scrollify({
section:".panel",
interstitialSection:"#layout-page-header,#layout-page-footer",
scrollbars:false,
before:function(i,panels) {
var ref = panels[i].attr("data-section-name");
$(".pagination .active").removeClass("active");
$(".pagination").find("a[href=\"#" + ref + "\"]").addClass("active");
$('.swiper-container').height('100%');
$('section.panel div.container').each(function(elem){
console.log($(window).height());
console.log($(this).height());
$(this).css({position: 'relative', top: ($(window).height() -$(this).height()) / 2 });
});
},
afterRender:function() {
var pagination = "<div class=\"pagination\">";
var activeClass = "";
$(".panel").each(function(i) {
activeClass = "";
if(i===0) {
activeClass = "active";
}
pagination += "<a class=\"" + activeClass + "\" href=\"#" + $(this).attr("data-section-name") + "\"><span class=\"hover-text\">" + $(this).attr("data-section-name") + "</span></a>";
});
pagination += "</div>";
$(".home").append(pagination);
/*
Tip: The two click events below are the same:
$(".pagination a").on("click",function() {
$.scrollify.move($(this).attr("href"));
});
*/
$(".pagination a").on("click",$.scrollify.move);
}
});
});

View File

@ -0,0 +1,843 @@
/*!
* jQuery Scrollify
* Version 1.0.19
*
* Requires:
* - jQuery 1.7 or higher
*
* https://github.com/lukehaas/Scrollify
*
* Copyright 2016, Luke Haas
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
if touchScroll is false - update index
*/
(function (global,factory) {
"use strict";
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['jquery'], function($) {
return factory($, global, global.document);
});
} else if (typeof module === 'object' && module.exports) {
// Node/CommonJS
module.exports = factory(require('jquery'), global, global.document);
} else {
// Browser globals
factory(jQuery, global, global.document);
}
}(typeof window !== 'undefined' ? window : this, function ($, window, document, undefined) {
"use strict";
var heights = [],
names = [],
elements = [],
overflow = [],
index = 0,
currentIndex = 0,
interstitialIndex = 1,
hasLocation = false,
timeoutId,
timeoutId2,
$window = $(window),
portHeight,
top = $window.scrollTop(),
scrollable = false,
locked = false,
scrolled = false,
manualScroll,
swipeScroll,
util,
disabled = false,
scrollSamples = [],
scrollTime = new Date().getTime(),
firstLoad = true,
initialised = false,
destination = 0,
wheelEvent = 'onwheel' in document ? 'wheel' : document.onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll',
settings = {
//section should be an identifier that is the same for each section
section: ".section",
sectionName: "section-name",
interstitialSection: "",
easing: "easeOutExpo",
scrollSpeed: 1100,
offset: 0,
scrollbars: true,
target:"html,body",
standardScrollElements: false,
setHeights: true,
overflowScroll:true,
updateHash: true,
touchScroll:true,
before:function() {},
after:function() {},
afterResize:function() {},
afterRender:function() {}
};
function getportHeight() {
return ($window.height() + settings.offset);
}
function animateScroll(index,instant,callbacks,toTop) {
if(currentIndex===index) {
callbacks = false;
}
if(disabled===true) {
return true;
}
if(names[index]) {
scrollable = false;
if(firstLoad===true) {
settings.afterRender();
firstLoad = false;
}
if(callbacks) {
if( typeof settings.before == 'function' && settings.before(index,elements) === false ){
return true;
}
}
interstitialIndex = 1;
destination = heights[index];
if(firstLoad===false && currentIndex>index && toTop===false) {
//We're going backwards
if(overflow[index]) {
portHeight = getportHeight();
interstitialIndex = parseInt(elements[index].outerHeight()/portHeight);
destination = parseInt(heights[index])+(elements[index].outerHeight()-portHeight);
}
}
if(settings.updateHash && settings.sectionName && !(firstLoad===true && index===0)) {
if(history.pushState) {
try {
history.replaceState(null, null, names[index]);
} catch (e) {
if(window.console) {
console.warn("Scrollify warning: Page must be hosted to manipulate the hash value.");
}
}
} else {
window.location.hash = names[index];
}
}
currentIndex = index;
if(instant) {
$(settings.target).stop().scrollTop(destination);
if(callbacks) {
settings.after(index,elements);
}
} else {
locked = true;
if( $().velocity ) {
$(settings.target).stop().velocity('scroll', {
duration: settings.scrollSpeed,
easing: settings.easing,
offset: destination,
mobileHA: false
});
} else {
$(settings.target).stop().animate({
scrollTop: destination
}, settings.scrollSpeed,settings.easing);
}
if(window.location.hash.length && settings.sectionName && window.console) {
try {
if($(window.location.hash).length) {
console.warn("Scrollify warning: ID matches hash value - this will cause the page to anchor.");
}
} catch (e) {}
}
$(settings.target).promise().done(function(){
locked = false;
firstLoad = false;
if(callbacks) {
settings.after(index,elements);
}
});
}
}
}
function isAccelerating(samples) {
function average(num) {
var sum = 0;
var lastElements = samples.slice(Math.max(samples.length - num, 1));
for(var i = 0; i < lastElements.length; i++){
sum += lastElements[i];
}
return Math.ceil(sum/num);
}
var avEnd = average(10);
var avMiddle = average(70);
if(avEnd >= avMiddle) {
return true;
} else {
return false;
}
}
var scrollify = function(options) {
initialised = true;
$.easing['easeOutExpo'] = function(x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
};
manualScroll = {
handleMousedown:function() {
if(disabled===true) {
return true;
}
scrollable = false;
scrolled = false;
},
handleMouseup:function() {
if(disabled===true) {
return true;
}
scrollable = true;
if(scrolled) {
//instant,callbacks
manualScroll.calculateNearest(false,true);
}
},
handleScroll:function() {
if(disabled===true) {
return true;
}
if(timeoutId){
clearTimeout(timeoutId);
}
timeoutId = setTimeout(function(){
scrolled = true;
if(scrollable===false) {
return false;
}
scrollable = false;
//instant,callbacks
manualScroll.calculateNearest(false,true);
}, 200);
},
calculateNearest:function(instant,callbacks) {
top = $window.scrollTop();
var i =1,
max = heights.length,
closest = 0,
prev = Math.abs(heights[0] - top),
diff;
for(;i<max;i++) {
diff = Math.abs(heights[i] - top);
if(diff < prev) {
prev = diff;
closest = i;
}
}
if((atBottom() && closest>index) || atTop()) {
index = closest;
//index, instant, callbacks, toTop
animateScroll(closest,instant,callbacks,false);
}
},
wheelHandler:function(e) {
if(disabled===true) {
return true;
} else if(settings.standardScrollElements) {
if($(e.target).is(settings.standardScrollElements) || $(e.target).closest(settings.standardScrollElements).length) {
return true;
}
}
if(!overflow[index]) {
e.preventDefault();
}
var currentScrollTime = new Date().getTime();
e = e || window.event;
var value = e.originalEvent.wheelDelta || -e.originalEvent.deltaY || -e.originalEvent.detail;
var delta = Math.max(-1, Math.min(1, value));
//delta = delta || -e.originalEvent.detail / 3 || e.originalEvent.wheelDelta / 120;
if(scrollSamples.length > 149){
scrollSamples.shift();
}
//scrollSamples.push(Math.abs(delta*10));
scrollSamples.push(Math.abs(value));
if((currentScrollTime-scrollTime) > 200){
scrollSamples = [];
}
scrollTime = currentScrollTime;
if(locked) {
return false;
}
if(delta<0) {
if(index<heights.length-1) {
if(atBottom()) {
if(isAccelerating(scrollSamples)) {
e.preventDefault();
index++;
locked = true;
//index, instant, callbacks, toTop
animateScroll(index,false,true, false);
} else {
return false;
}
}
}
} else if(delta>0) {
if(index>0) {
if(atTop()) {
if(isAccelerating(scrollSamples)) {
e.preventDefault();
index--;
locked = true;
//index, instant, callbacks, toTop
animateScroll(index,false,true, false);
} else {
return false
}
}
}
}
},
keyHandler:function(e) {
if(disabled===true || document.activeElement.readOnly===false) {
return true;
}
if(locked===true) {
return false;
}
if(e.keyCode==38 || e.keyCode==33) {
if(index>0) {
if(atTop()) {
e.preventDefault();
index--;
//index, instant, callbacks, toTop
animateScroll(index,false,true,false);
}
}
} else if(e.keyCode==40 || e.keyCode==34) {
if(index<heights.length-1) {
if(atBottom()) {
e.preventDefault();
index++;
//index, instant, callbacks, toTop
animateScroll(index,false,true,false);
}
}
}
},
init:function() {
if(settings.scrollbars) {
$window.on('mousedown', manualScroll.handleMousedown);
$window.on('mouseup', manualScroll.handleMouseup);
$window.on('scroll', manualScroll.handleScroll);
} else {
$("body").css({"overflow":"hidden"});
}
$window.on(wheelEvent,manualScroll.wheelHandler);
//$(document).bind(wheelEvent,manualScroll.wheelHandler);
$window.on('keydown', manualScroll.keyHandler);
}
};
swipeScroll = {
touches : {
"touchstart": {"y":-1,"x":-1},
"touchmove" : {"y":-1,"x":-1},
"touchend" : false,
"direction" : "undetermined"
},
options:{
"distance" : 30,
"timeGap" : 800,
"timeStamp" : new Date().getTime()
},
touchHandler: function(event) {
if(disabled===true) {
return true;
} else if(settings.standardScrollElements) {
if($(event.target).is(settings.standardScrollElements) || $(event.target).closest(settings.standardScrollElements).length) {
return true;
}
}
var touch;
if (typeof event !== 'undefined'){
if (typeof event.touches !== 'undefined') {
touch = event.touches[0];
switch (event.type) {
case 'touchstart':
swipeScroll.touches.touchstart.y = touch.pageY;
swipeScroll.touches.touchmove.y = -1;
swipeScroll.touches.touchstart.x = touch.pageX;
swipeScroll.touches.touchmove.x = -1;
swipeScroll.options.timeStamp = new Date().getTime();
swipeScroll.touches.touchend = false;
case 'touchmove':
swipeScroll.touches.touchmove.y = touch.pageY;
swipeScroll.touches.touchmove.x = touch.pageX;
if(swipeScroll.touches.touchstart.y!==swipeScroll.touches.touchmove.y && (Math.abs(swipeScroll.touches.touchstart.y-swipeScroll.touches.touchmove.y)>Math.abs(swipeScroll.touches.touchstart.x-swipeScroll.touches.touchmove.x))) {
//if(!overflow[index]) {
event.preventDefault();
//}
swipeScroll.touches.direction = "y";
if((swipeScroll.options.timeStamp+swipeScroll.options.timeGap)<(new Date().getTime()) && swipeScroll.touches.touchend == false) {
swipeScroll.touches.touchend = true;
if (swipeScroll.touches.touchstart.y > -1) {
if(Math.abs(swipeScroll.touches.touchmove.y-swipeScroll.touches.touchstart.y)>swipeScroll.options.distance) {
if(swipeScroll.touches.touchstart.y < swipeScroll.touches.touchmove.y) {
swipeScroll.up();
} else {
swipeScroll.down();
}
}
}
}
}
break;
case 'touchend':
if(swipeScroll.touches[event.type]===false) {
swipeScroll.touches[event.type] = true;
if (swipeScroll.touches.touchstart.y > -1 && swipeScroll.touches.touchmove.y > -1 && swipeScroll.touches.direction==="y") {
if(Math.abs(swipeScroll.touches.touchmove.y-swipeScroll.touches.touchstart.y)>swipeScroll.options.distance) {
if(swipeScroll.touches.touchstart.y < swipeScroll.touches.touchmove.y) {
swipeScroll.up();
} else {
swipeScroll.down();
}
}
swipeScroll.touches.touchstart.y = -1;
swipeScroll.touches.touchstart.x = -1;
swipeScroll.touches.direction = "undetermined";
}
}
default:
break;
}
}
}
},
down: function() {
if(index<heights.length) {
if(atBottom() && index<heights.length-1) {
index++;
//index, instant, callbacks, toTop
animateScroll(index,false,true,false);
} else {
portHeight = getportHeight();
if(Math.floor(elements[index].height()/portHeight)>interstitialIndex) {
interstitialScroll(parseInt(heights[index])+(portHeight*interstitialIndex));
interstitialIndex += 1;
} else {
interstitialScroll(parseInt(heights[index])+(elements[index].outerHeight()-portHeight));
}
}
}
},
up: function() {
if(index>=0) {
if(atTop() && index>0) {
index--;
//index, instant, callbacks, toTop
animateScroll(index,false,true,false);
} else {
if(interstitialIndex>2) {
portHeight = getportHeight();
interstitialIndex -= 1;
interstitialScroll(parseInt(heights[index])+(portHeight*interstitialIndex));
} else {
interstitialIndex = 1;
interstitialScroll(parseInt(heights[index]));
}
}
}
},
init: function() {
if (document.addEventListener && settings.touchScroll) {
var eventListenerOptions = {
passive: false
};
document.addEventListener('touchstart', swipeScroll.touchHandler, eventListenerOptions);
document.addEventListener('touchmove', swipeScroll.touchHandler, eventListenerOptions);
document.addEventListener('touchend', swipeScroll.touchHandler, eventListenerOptions);
}
}
};
util = {
refresh:function(withCallback,scroll) {
clearTimeout(timeoutId2);
timeoutId2 = setTimeout(function() {
//retain position
sizePanels(true);
//scroll, firstLoad
calculatePositions(scroll,false);
if(withCallback) {
settings.afterResize();
}
},400);
},
handleUpdate:function() {
//callbacks, scroll
//changed from false,true to false,false
util.refresh(false,false);
},
handleResize:function() {
//callbacks, scroll
util.refresh(true,false);
},
handleOrientation:function() {
//callbacks, scroll
util.refresh(true,true);
}
};
settings = $.extend(settings, options);
//retain position
sizePanels(false);
calculatePositions(false,true);
if(true===hasLocation) {
//index, instant, callbacks, toTop
animateScroll(index,false,true,true);
} else {
setTimeout(function() {
//instant,callbacks
manualScroll.calculateNearest(true,false);
},200);
}
if(heights.length) {
manualScroll.init();
swipeScroll.init();
$window.on("resize",util.handleResize);
if (document.addEventListener) {
window.addEventListener("orientationchange", util.handleOrientation, false);
}
}
function interstitialScroll(pos) {
if( $().velocity ) {
$(settings.target).stop().velocity('scroll', {
duration: settings.scrollSpeed,
easing: settings.easing,
offset: pos,
mobileHA: false
});
} else {
$(settings.target).stop().animate({
scrollTop: pos
}, settings.scrollSpeed,settings.easing);
}
}
function sizePanels(keepPosition) {
if(keepPosition) {
top = $window.scrollTop();
}
var selector = settings.section;
overflow = [];
if(settings.interstitialSection.length) {
selector += "," + settings.interstitialSection;
}
if(settings.scrollbars===false) {
settings.overflowScroll = false;
}
portHeight = getportHeight();
$(selector).each(function(i) {
var $this = $(this);
if(settings.setHeights) {
if($this.is(settings.interstitialSection)) {
overflow[i] = false;
} else {
if(($this.css("height","auto").outerHeight()<portHeight) || $this.css("overflow")==="hidden") {
$this.css({"height":portHeight});
overflow[i] = false;
} else {
$this.css({"height":$this.height()});
if(settings.overflowScroll) {
overflow[i] = true;
} else {
overflow[i] = false;
}
}
}
} else {
if(($this.outerHeight()<portHeight) || (settings.overflowScroll===false)) {
overflow[i] = false;
} else {
overflow[i] = true;
}
}
});
if(keepPosition) {
$window.scrollTop(top);
}
}
function calculatePositions(scroll,firstLoad) {
var selector = settings.section;
if(settings.interstitialSection.length) {
selector += "," + settings.interstitialSection;
}
heights = [];
names = [];
elements = [];
$(selector).each(function(i){
var $this = $(this);
if(i>0) {
heights[i] = parseInt($this.offset().top) + settings.offset;
} else {
heights[i] = parseInt($this.offset().top);
}
if(settings.sectionName && $this.data(settings.sectionName)) {
names[i] = "#" + $this.data(settings.sectionName).toString().replace(/ /g,"-");
} else {
if($this.is(settings.interstitialSection)===false) {
names[i] = "#" + (i + 1);
} else {
names[i] = "#";
if(i===$(selector).length-1 && i>1) {
heights[i] = heights[i-1] + (parseInt($($(selector)[i-1]).outerHeight()) - parseInt($(window).height())) + parseInt($this.outerHeight());
}
}
}
elements[i] = $this;
try {
if($(names[i]).length && window.console) {
console.warn("Scrollify warning: Section names can't match IDs - this will cause the browser to anchor.");
}
} catch (e) {}
if(window.location.hash===names[i]) {
index = i;
hasLocation = true;
}
});
if(true===scroll) {
//index, instant, callbacks, toTop
animateScroll(index,false,false,false);
}
}
function atTop() {
if(!overflow[index]) {
return true;
}
top = $window.scrollTop();
if(top>parseInt(heights[index])) {
return false;
} else {
return true;
}
}
function atBottom() {
if(!overflow[index]) {
return true;
}
top = $window.scrollTop();
portHeight = getportHeight();
if(top<parseInt(heights[index])+(elements[index].outerHeight()-portHeight)-28) {
return false;
} else {
return true;
}
}
}
function move(panel,instant) {
var z = names.length;
for(;z>=0;z--) {
if(typeof panel === 'string') {
if (names[z]===panel) {
index = z;
//index, instant, callbacks, toTop
animateScroll(z,instant,true,true);
}
} else {
if(z===panel) {
index = z;
//index, instant, callbacks, toTop
animateScroll(z,instant,true,true);
}
}
}
}
scrollify.move = function(panel) {
if(panel===undefined) {
return false;
}
if(panel.originalEvent) {
panel = $(this).attr("href");
}
move(panel,false);
};
scrollify.instantMove = function(panel) {
if(panel===undefined) {
return false;
}
move(panel,true);
};
scrollify.next = function() {
if(index<names.length) {
index += 1;
//index, instant, callbacks, toTop
animateScroll(index,false,true,true);
}
};
scrollify.previous = function() {
if(index>0) {
index -= 1;
//index, instant, callbacks, toTop
animateScroll(index,false,true,true);
}
};
scrollify.instantNext = function() {
if(index<names.length) {
index += 1;
//index, instant, callbacks, toTop
animateScroll(index,true,true,true);
}
};
scrollify.instantPrevious = function() {
if(index>0) {
index -= 1;
//index, instant, callbacks, toTop
animateScroll(index,true,true,true);
}
};
scrollify.destroy = function() {
if(!initialised) {
return false;
}
if(settings.setHeights) {
$(settings.section).each(function() {
$(this).css("height","auto");
});
}
$window.off("resize",util.handleResize);
if(settings.scrollbars) {
$window.off('mousedown', manualScroll.handleMousedown);
$window.off('mouseup', manualScroll.handleMouseup);
$window.off('scroll', manualScroll.handleScroll);
}
$window.off(wheelEvent,manualScroll.wheelHandler);
$window.off('keydown', manualScroll.keyHandler);
if (document.addEventListener && settings.touchScroll) {
document.removeEventListener('touchstart', swipeScroll.touchHandler, false);
document.removeEventListener('touchmove', swipeScroll.touchHandler, false);
document.removeEventListener('touchend', swipeScroll.touchHandler, false);
}
heights = [];
names = [];
elements = [];
overflow = [];
};
scrollify.update = function() {
if(!initialised) {
return false;
}
util.handleUpdate();
};
scrollify.current = function() {
return elements[index];
};
scrollify.currentIndex = function() {
return index;
};
scrollify.disable = function() {
disabled = true;
};
scrollify.enable = function() {
disabled = false;
if (initialised) {
//instant,callbacks
manualScroll.calculateNearest(false,false);
}
};
scrollify.isDisabled = function() {
return disabled;
};
scrollify.setOptions = function(updatedOptions) {
if(!initialised) {
return false;
}
if(typeof updatedOptions === "object") {
settings = $.extend(settings, updatedOptions);
util.handleUpdate();
} else if(window.console) {
console.warn("Scrollify warning: setOptions expects an object.");
}
};
$.scrollify = scrollify;
return scrollify;
}));