Please see the image below as it helps understand what the issue is.

enter image description here

When the complete form cta button is clicked, it scrolls up to the top of the page after revealing the form instead of stopping at the beginning of the form. I added javascript to the button to reveal the form which is by default hidden.


          <a id="btn" class="btn" role="button" 

href="javascript:void(0)" onclick="resetScrollpoint('#contact-form-wrap')" target="<?php echo $link['target']; ?>" title="<?php echo $link['title']; ?>">
                <?php echo $link['title']; ?>

Form Element:

  <div id="contact-form-wrap" class="contact-form-wrap" style="display:none;"> <?php echo do_shortcode("$contact"); ?></div>


function resetScrollpoint(selector) {
  if(!selector) return false;
  window.scroll(0,jQuery(selector).offset().top - jQuery('#header').height());

Link to the live page is here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.