Created
March 14, 2017 16:29
-
-
Save mustafix/175c6c7289ae95efad1915582f4a5c66 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/*-------------------------------------------- | |
Scroll up | |
---------------------------------------------*/ | |
jQuery(function($){ | |
jQuery.scrollUp({ | |
scrollText: '<i class="fa fa-angle-up"></i>' | |
}); | |
}); |
This file contains hidden or 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
1. call scrollup.js on your file | |
2. call css code on style.css | |
3. active scroll up |
This file contains hidden or 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
/* | |
scrollup v2.0.0 | |
Author: Mark Goodyear - http://markgoodyear.com | |
Git: https://github.com/markgoodyear/scrollup | |
Copyright 2013 Mark Goodyear. | |
Licensed under the MIT license | |
http://www.opensource.org/licenses/mit-license.php | |
Twitter: @markgdyr | |
*/ | |
!function(a,b,c){a.fn.scrollUp=function(b){a.data(c.body,"scrollUp")||(a.data(c.body,"scrollUp",!0),a.fn.scrollUp.init(b))},a.fn.scrollUp.init=function(d){var e=a.fn.scrollUp.settings=a.extend({},a.fn.scrollUp.defaults,d),f=a("<a/>",{id:e.scrollName,href:"#top",title:e.scrollText}).appendTo("body");e.scrollImg||f.html(e.scrollText),f.css({display:"none",position:"fixed",zIndex:e.zIndex}),e.activeOverlay&&a("<div/>",{id:e.scrollName+"-active"}).css({position:"absolute",top:e.scrollDistance+"px",width:"100%",borderTop:"1px dotted"+e.activeOverlay,zIndex:e.zIndex}).appendTo("body"),scrollEvent=a(b).scroll(function(){switch(scrollDis="top"===e.scrollFrom?e.scrollDistance:a(c).height()-a(b).height()-e.scrollDistance,e.animation){case"fade":a(a(b).scrollTop()>scrollDis?f.fadeIn(e.animationInSpeed):f.fadeOut(e.animationOutSpeed));break;case"slide":a(a(b).scrollTop()>scrollDis?f.slideDown(e.animationInSpeed):f.slideUp(e.animationOutSpeed));break;default:a(a(b).scrollTop()>scrollDis?f.show(0):f.hide(0))}}),f.click(function(b){b.preventDefault(),a("html, body").animate({scrollTop:0},e.topSpeed,e.easingType)})},a.fn.scrollUp.defaults={scrollName:"scrollUp",scrollDistance:300,scrollFrom:"top",scrollSpeed:300,easingType:"linear",animation:"fade",animationInSpeed:200,animationOutSpeed:200,scrollText:"Scroll to top",scrollImg:!1,activeOverlay:!1,zIndex:2147483647},a.fn.scrollUp.destroy=function(d){a.removeData(c.body,"scrollUp"),a("#"+a.fn.scrollUp.settings.scrollName).remove(),a("#"+a.fn.scrollUp.settings.scrollName+"-active").remove(),a.fn.jquery.split(".")[1]>=7?a(b).off("scroll",d):a(b).unbind("scroll",d)},a.scrollUp=a.fn.scrollUp}(jQuery,window,document); |
This file contains hidden or 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
/* Scroll to up css*/ | |
a#scrollUp { | |
background: orange none repeat scroll 0 0; | |
bottom: 20px; | |
color: #fff; | |
font-size: 20px; | |
height: 35px; | |
padding: 4px; | |
right: 20px; | |
text-align: center; | |
width: 30px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment