Still working on my site: http://i333180.iris.fhict.nl/p2_vc/
There is a button to navigate down the te page, the action is instantaneous, but smooth scrolling is much nicer.
So, I google around, tried a lot, and the shortest script I found is: But I can't get it to work.
$(function() { $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 1000); return false; } } }); });
Link: https://css-tricks.com/snippets/jquery/smooth-scrolling/
This is how I added to my code between
<head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(function() { $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body').animate({ scrollTop: target.offset().top }, 1000); return false; } } }); }); </script> </head>
Button
<body> <a id='button_down' href='#section' onclick="document.getElementById('moodvideo').pause()"><img src='scroll.png' alt='Scroll'></a> </body>
I checked the example site that was specified and added it in the same way as my html. Link checked: https://css-tricks.com/examples/SmoothPageScroll/ But I can't get it to work.
In addition, I have another script, the witch needs the same action after the video ends. Script for this now:
<script> function videoEnded() { window.location.href="#section"; } </script>
This should do the same; scroll image.
I was hoping I would explain it clearly, if not, I would like to try again. Relationship
An EDIT script is not added to the online site because the script is not working yet, if it makes it easier, I can add it online.
update the site on the network with broken scripts