Onclick Scroll and Animate Sections.

Written by

in

This Code will animate on button click like Fultion .

Frist make a section Fixed with height 100vh. Added floating button there. Add ID “expertise”.
Overlap a section with 100vh, transparent Background. Add ID “blanked”.
Make content section. Add Content and rest of other there. Add ID “starts”.

Now Use this code. JQuery.

 

 

 

jQuery("#expertise").on("click", function() {
jQuery('#blanked').animate({
height: '0px'
}, 1000);
jQuery("html, body").animate({
scrollTop: 0
}, 600);
});
jQuery(window).on("scroll", function() {
let scrollTop = jQuery(this).scrollTop();
let Section2 = jQuery("#starts").offset().top;
if (scrollTop === Section2) {
jQuery('#blanked').animate({
height: '100vh'
}, 1000);
}
});

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Chat Icon
Preview