neilgee
9/30/2016 - 9:00 AM

Scroll to Top - My Choice of posion

Scroll to Top - My Choice of posion

<?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 );
}

jQuery(document).ready(function($){

$(function() {
 $("#toTop").scrollToTop(800);
 });

});
#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;
}
<?php //<~ don't add me in

add_action('wp_footer','prefix_scroll');

function prefix_scroll() {
  echo '<a href="#top" id="toTop"></a>';
}