GregLassale Posted April 7, 2020 Share Posted April 7, 2020 Site URL: http://gregorylassale.com Hi, I've been trying forever to figure out how to add animated / clickable scroll down arrows on my site. I found this page https://codepen.io/nxworld/pen/OyRrGy I like the arrow in section 5. Through trial and error, I managed to remove the code that didn't seem necessary for me and I tweaked the ID and class tag a bit. Would it work on my site? If so, do I put the HTML in a code block? Does the CSS go in Custom CSS and the javascript in the Code Injection header? The HTML <section id="arrow" class="scroll"> <a href="#services"><span></span>Scroll</a> </section> The CSS .scroll a { position: absolute; bottom: 20px; left: 50%; z-index: 2; display: inline-block; -webkit-transform: translate(0, -50%); transform: translate(0, -50%); color: black; font : normal 400 20px/1 'montserrat', sans-serif; letter-spacing: .1em; text-decoration: none; transition: opacity .3s; } .scroll a:hover { opacity: .5; } #arrow a { padding-top: 70px; } #arrow a span { position: absolute; top: 0; left: 50%; width: 24px; height: 24px; margin-left: -12px; border-left: 1px solid black; border-bottom: 1px solid black; -webkit-transform: rotate(-45deg); transform: rotate(-45deg); -webkit-animation: sdb05 1.5s infinite; animation: sdb05 1.5s infinite; box-sizing: border-box; } @-webkit-keyframes sdb05 { 0% { -webkit-transform: rotate(-45deg) translate(0, 0); opacity: 0; } 50% { opacity: 1; } 100% { -webkit-transform: rotate(-45deg) translate(-20px, 20px); opacity: 0; } } @keyframes sdb05 { 0% { transform: rotate(-45deg) translate(0, 0); opacity: 0; } 50% { opacity: 1; } 100% { transform: rotate(-45deg) translate(-20px, 20px); opacity: 0; } } The JS: <script> $(function() { $('a[href*=#]').on('click', function(e) { e.preventDefault(); $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top}, 500, 'linear'); }); }); </script> Thanks in advance for any help. Link to comment
GregLassale Posted April 7, 2020 Author Share Posted April 7, 2020 Nevermind. I figured it all out. Thanks. Link to comment
carolinacantante Posted April 17, 2020 Share Posted April 17, 2020 how did you do it? Link to comment
tuanphan Posted April 18, 2020 Share Posted April 18, 2020 Add all to Code Block (with CSS, wrap in style tag <style>paste css here</style>) 11 hours ago, carolinacantante said: how did you do it? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
carolinacantante Posted April 24, 2020 Share Posted April 24, 2020 On 4/18/2020 at 3:02 AM, tuanphan said: Add all to Code Block (with CSS, wrap in style tag <style>paste css here</style>) but what should be inside de paste css here i need to add an arrow to scroll down Link to comment
tuanphan Posted April 25, 2020 Share Posted April 25, 2020 20 hours ago, carolinacantante said: but what should be inside de paste css here i need to add an arrow to scroll down <section id="arrow" class="scroll"> <a href="#services"><span></span>Scroll</a> </section> <style> .scroll a { position: absolute; bottom: 20px; left: 50%; z-index: 2; display: inline-block; -webkit-transform: translate(0, -50%); transform: translate(0, -50%); color: black; font : normal 400 20px/1 'montserrat', sans-serif; letter-spacing: .1em; text-decoration: none; transition: opacity .3s; } .scroll a:hover { opacity: .5; } #arrow a { padding-top: 70px; } #arrow a span { position: absolute; top: 0; left: 50%; width: 24px; height: 24px; margin-left: -12px; border-left: 1px solid black; border-bottom: 1px solid black; -webkit-transform: rotate(-45deg); transform: rotate(-45deg); -webkit-animation: sdb05 1.5s infinite; animation: sdb05 1.5s infinite; box-sizing: border-box; } @-webkit-keyframes sdb05 { 0% { -webkit-transform: rotate(-45deg) translate(0, 0); opacity: 0; } 50% { opacity: 1; } 100% { -webkit-transform: rotate(-45deg) translate(-20px, 20px); opacity: 0; } } @keyframes sdb05 { 0% { transform: rotate(-45deg) translate(0, 0); opacity: 0; } 50% { opacity: 1; } 100% { transform: rotate(-45deg) translate(-20px, 20px); opacity: 0; } } </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script> <script> $(function() { $('a[href*=#]').on('click', function(e) { e.preventDefault(); $('html, body').animate({ scrollTop: $($(this).attr('href')).offset().top}, 500, 'linear'); }); }); </script> Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message How to: Setup Password & Share url - Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.