@link https://premium.wpmudev.org/blog/back-to-top-button-wordpress/
Last active
July 27, 2017 21:51
-
-
Save jekkilekki/2ec33a8f0a4dedf06014 to your computer and use it in GitHub Desktop.
Make a Back to Top button in WordPress
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 | |
function enqueue_my_scripts() { | |
wp_enqueue_script( | |
'custom-script', | |
get_stylesheet_directory_uri() . '/js/topbutton.js', | |
array( 'jquery' ) | |
); | |
} | |
add_action( 'wp_enqueue_scripts', 'my_scripts_method' ); |
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
.topbutton { | |
font-family: "FontAwesome"; | |
content: '\f077'; // fa-chevron-up | |
color: $color__white; | |
background-color: darken( $color__bright_blue, 10% ); | |
height: 30px; | |
width: 40px; | |
position: fixed; | |
right: 20px; | |
bottom: 20px; | |
z-index: 1; | |
display: none; | |
.icon { | |
display: block; | |
margin: 0 auto; | |
top: 2px; | |
} | |
&:before { | |
content: ""; | |
display: block; | |
position: absolute; | |
top: -5px; | |
-webkit-transform: skewY(14deg); | |
transform: skewY(14deg); | |
width: 100%; | |
height: 100%; | |
background-color: darken( $color__bright_blue, 10% ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment