Smooth scrolling doesn't work
-
wrote on Oct 17, 2017, 2:10 PM last edited by
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 -
-
wrote on Oct 18, 2017, 9:08 AM last edited by
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 @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,
Alexanderwrote on Oct 22, 2017, 12:55 PM last edited byHi @mariusjopen,
Do you have any ideas how to solve this technical issue?
I'd be grateful for your help.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
I also code custom websites or custom Lay features.
💿 Email me here: 💿
info@laytheme.com
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