Aymanshafei (Talk | contribs) |
Aymanshafei (Talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
<html> | <html> | ||
+ | <button id="myBtn" title="Go to top"><i class="fa fa-arrow-up fa-3x"></i></button> | ||
<footer style='bottom: 0px; | <footer style='bottom: 0px; | ||
position: fixed; | position: fixed; | ||
Line 24: | Line 25: | ||
</div> | </div> | ||
</footer> | </footer> | ||
+ | <script> | ||
+ | $(document).ready(function() { | ||
+ | $('#myBtn').click(function(){ | ||
+ | document.body.scrollTop = 0; | ||
+ | document.documentElement.scrollTop = 0; | ||
+ | }) | ||
+ | window.onscroll = function () { scrollFunction() }; | ||
+ | function scrollFunction() { | ||
+ | if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) { | ||
+ | document.getElementById("myBtn").style.display = "block"; | ||
+ | } else { | ||
+ | document.getElementById("myBtn").style.display = "none"; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | document.getElementById('navbar-toggle').onclick = function () { | ||
+ | var active = document.querySelector(".navbar-collapse"); | ||
+ | active.classList.toggle("in"); | ||
+ | }}); | ||
+ | </script> | ||
</html> | </html> |
Latest revision as of 13:32, 27 October 2017