Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth scroll #98

Merged
merged 3 commits into from
Sep 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<ul class="menu">
<li><a href="#home-nav">HOME</a></li>
<li><a href="#about-nav">ABOUT</a></li>
<li><a href="#fearures-nav">FEATURES</a></li>
<li><a href="#features-nav">FEATURES</a></li>
<li><a href="#reviews-nav">REVIEWS</a></li>
<li><a href="#screens-nav">SCREENS</a></li>
<li><a href="#blog-nav">BLOG</a></li>
Expand Down Expand Up @@ -154,7 +154,7 @@ <h3>AND MANY MORE</h3>
</div>
<div class="arrow-position-wrapper">
<span class="sm-semicircular-eclipse-border"><span class="icon-quotes"></span></span>
<h2 class="center-align">App Reviews</h2>
<h2 id="reviews-nav" class="center-align">App Reviews</h2>
<h4>Read What Our Happy Customers Are Saying</h4>
<span class="focus-arrow">&nbsp;</span>
</div>
Expand Down Expand Up @@ -210,7 +210,7 @@ <h1><span>Download</span> Our App</h1>
<a href="#"><span class="icon-apple"></span>iOS App Store</a>
<form action=""><fieldset><legend>Subscribe To Newsletter</legend><input type="email" placeholder="Enter your email address"/><button type="submit">SUBMIT</button></fieldset></form>
</section>
<section>
<section id="blog-nav">
<h1>Discounted Pricing</h1>
<p>Nullam id odio quis risus placerat aliquam. Cum sociis natoque penatibus et magnis dis part urient montes nascetur ridiculus mus curabitur tellus lacus.</p>
<ul class="pricing-list">
Expand Down Expand Up @@ -384,6 +384,7 @@ <h1>Flickr Widget</h1>
<script type="text/javascript" src="js/deps/unslider.min.js"></script>
<script type="text/javascript" src="js/carousel.js"></script>
<script type="text/javascript" src="js/video.js"></script>
<script type="text/javascript" src="js/smooth-scroll.js"></script>
<script type="text/javascript" src="js/nav-search.js"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions public/js/smooth-scroll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

$('.menu a').on('click', function(e) {
e.preventDefault();
var target = this.hash;
var $target = $(target);
var $targetOffset = $target.offset().top-80;
// top-80 is for where the scroll stops
// offset from top by 80px
$('html, body').stop().animate({
'scrollTop': $targetOffset
}, 1600, 'swing', function () {
window.location.hash = target;
});
});


// Adapted from: http://www.paulund.co.uk/smooth-scroll-to-internal-links-with-jquery