Smooth scrolling doesn't work
-
Hi guys,
Can you help me with smooth scrolling on my website. Script works but without smooth scrolling.
Website is under construction but you can try this on the menu below cover page: https://aplace.pl/video#Thanks in advance.
Best,
Alexander -
-
Hi @mariusjopen
This one:
<script>
jQuery(document).ready(function(){
jQuery('body').on('click', '#view-more', function(event) {
event.preventDefault();
var id = jQuery(this).attr('href');
jQuery('html, body').animate( { scrollTop: jQuery(id).offset().top }, 750, 'easeOutExpo' );
});
})
<script>Best,
Alexander -
Hi @PapaSasha
ok. Try this code here:
<script> jQuery(document).on("click", "#view-more", function(event) { event.preventDefault(); jQuery('html, body').animate({ scrollTop: jQuery("#view-more-anchor").offset().top }, 500); }); </script>
You need to make two divs of course. One with the ID
#view-more;
and the other one with the ID#view-more-anchor;
.In your code you also did not consider this:
http://laytheme.com/documentation.html#custom-javascriptBest!
Marius
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it