Good day! This script automatically scrolls the page to the .cover-b block immediately after loading the page itself.
<a href="#" id="top"><div class="arrow arrow_top"></div></a> $(document).ready(function() { var height = $(this).height(); var scrollTop = $(this).scrollTop(); if(scrollTop <= height) { $('html, body').delay(1).animate({ scrollTop: $(".cover-b").offset().top }, 600, 'easeOutQuint', function() { if(!isComplete) { isComplete = true; } }); } }); Please help me add the function of scrolling the page up to the existing script by clicking on the link with id = "top". Thank you for your help!
html:
<html> <head> </head> <body> <div class="cover"> <div class="content"> </div> <div class="cover-b"></div> </div> <div class="page" id="page"> </div> <div id="top-panel"> <a href="#" id="top"><div class="arrow arrow_top"></div></a> </div> <div class="footer"> <div class="fbox"> </div> </div> </body> </html> css:
.cover { position: relative; overflow: hidden; min-height: 100%; background: url(cover.jpg) no-repeat; background-size: cover; background-position: right bottom; visibility: visible; box-sizing: border-box; } .cover .content { position: relative; width: 100%; height: 100%; } .cover-b { position: absolute; bottom: 0; width: 100%; height: 76px; } .page { margin: 0 auto; width: 100%; } #top-panel { position: fixed; overflow: hidden; width: 100%; height: 66px; top: 0; } #top { width: 36px; height: 36px; position: absolute; } #top .arrow { position: relative; } #top .arrow_top { width: 0px; height: 0px; } #top .arrow_top:after { position: absolute; content:""; width: 10px; height: 10px; } css cleaned out too much