Skip to content
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.

Commit

Permalink
added the scroll to top button work
Browse files Browse the repository at this point in the history
added the code to make the scroll to top button actually scroll to the top *-*
  • Loading branch information
Yannick committed Jun 3, 2017
1 parent dff465d commit a82fd57
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 0 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
function learningWordPress_resources() {

wp_enqueue_style('style', get_stylesheet_uri());

}

add_action('wp_enqueue_scripts', 'learningWordPress_resources');
Expand Down
2 changes: 2 additions & 0 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<meta name="viewport" content="width=device-width">
<title><?php bloginfo('name'); ?></title>
<script src="https://use.fontawesome.com/e48fabcf5a.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
<script src="http://20578.tk/architect-wordpress/wp-content/themes/architect/js/smoothscroll.js"></script>
<?php wp_head(); ?>
</head>

Expand Down
13 changes: 13 additions & 0 deletions js/smoothscroll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
jQuery(document).ready(function($){
$(window).scroll(function(){
if ($(this).scrollTop() < 200) {
$('#smoothup') .fadeOut();
} else {
$('#smoothup') .fadeIn();
}
});
$('#totop').on('click', function(){
$('html, body').animate({scrollTop:0}, 'fast');
return false;
});
});

0 comments on commit a82fd57

Please sign in to comment.