Last active
June 27, 2017 23:11
-
-
Save neilgee/95d7544fcf101f47357ed495c30cf002 to your computer and use it in GitHub Desktop.
Scroll to Top - My Choice of posion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //<~ don't add me in | |
add_action('wp_footer','prefix_scroll'); | |
function prefix_scroll() { | |
echo '<a href="#top" id="toTop"></a>'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#toTop { | |
display: none; | |
position: fixed; | |
bottom: 5px; | |
right: 10px; | |
width: 80px; | |
height: 80px; | |
opacity: 0.8; | |
filter: alpha(opacity=40); /* For IE8 and earlier */ | |
} | |
#toTop:after { | |
content: "\f343"; | |
font-family: dashicons; | |
color: #fff; | |
background-color: #444; | |
font-size: 35px; | |
border-radius: 50%; | |
padding: 5px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
$(function() { | |
$("#toTop").scrollToTop(800); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //<~ don't add me in | |
add_action( 'wp_enqueue_scripts', 'scrollo_scripts_styles', 997 ); // All the rest load before. | |
function scrollo_scripts_styles() { | |
wp_enqueue_script( 'scrollo' , get_stylesheet_directory_uri() . '/js/jquery.scrollToTop.min.js', array( 'jquery' ), '1', true ); | |
wp_enqueue_script( 'scrollo-init' , get_stylesheet_directory_uri() . '/js/scroll-init.js', array( 'scrollo' ), '1', true ); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment