1 | < div id = "gotop" >< a class = "gotop" ></ a ></ div > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | .gotop { cursor : pointer ; position : fixed ; right : 25px ; bottom : 25px ; z-index : 99999 ; display : block ; width : 50px ; height : 50px ; background : url (../images/backtop.png) no-repeat 0 0 ; opacity: 0.5 ; filter: alpha(opacity= 50 ); /*动画效果*/ outline : none ; transition: all 0.30 s ease-in-out; -webkit-transition: all 0.30 s ease-in-out; -moz-transition: all 0.30 s ease-in-out; -o-transition: all 0.30 s ease-in-out; -ms-transition: all 0.30 s ease-in-out; } .gotop:hover { background : url (../images/backtop.png) no-repeat 0 -52px ; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 | $( "#gotop" ).hide(); $(window).scroll(function () { if ($(window).scrollTop() > 100) { $( "#gotop" ).fadeIn() } else { $( "#gotop" ).fadeOut() } }); $( "#gotop" ).click(function () { $( 'html,body' ).animate({ 'scrollTop' : 0 }, 500) }); |
苏公网安备 32132202001088号
| Copyright 北极熊 北格技术 版权所有