Garmaine Staff asked 2 years ago

I have a WordPress website using the Divi Builder. I am using jQuery javascript to hide the bottom sections of the website until the visitor clicks on Learn More. This causes the Learn More text to disappear and the bottom sections to appear. However, I would like to add a ScrollTo action so it takes the visitor to the lower sections. I keep a bottom section visible, just empty for scrolling reference.

I have tried numerous various and cannot get the ScrollTo action to happen. It either breaks the script or ignores it. I made sure to turn on the alternative scrolling switch. If I try to use a standard anchor link "#target", it does this and ignores the jQuery script.

Here is the base script:

<script type="text/javascript">
 jQuery(document).ready(function() {
// Hide the div
jQuery('#reveal').hide();
jQuery('#reveal_text').show();
jQuery('.rv_button').click(function(e){
e.preventDefault();
jQuery("#reveal").slideToggle();
jQuery("#reveal_text").slideToggle();
jQuery('.rv_button').toggleClass('opened closed');
});
});

How can I add a ScrollTo action at the end of the script?