0

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.

HTML:

          <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']; ?>
              </a>

Form Element:

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

JS:

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

Link to the live page is here

0

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.