- This topic has 8 replies, 2 voices, and was last updated 7 years, 12 months ago by
Tom.
-
AuthorPosts
-
April 2, 2018 at 6:17 pm #539207
Carol
What is the best way to force the page to load exactly below the top header and navigation? Here is the page I’m working on: https://ncsfa.site/convention-2018/
What I’m trying to do is have the page load with only the slider showing on the viewpoint. The user will have to scroll up to see the top header content.
I’ve tried to insert an elementor anchor at the top of the slider with a class of slider-top. But I don’t know how to link to this page anchor on page load.
Any help would gladly be appreciated.
April 2, 2018 at 9:16 pm #539296Tom
Lead DeveloperLead DeveloperYou could try to use javascript.
Something like this in the wp_footer hook might work:
<script> jQuery(document).ready(function ($) { $('html, body').scrollTop( 300 ); }); </script>300 being the height in pixels to start the page at.
April 3, 2018 at 10:16 am #540003Carol
Yes, but wouldn’t that be applied to all pages? And what if I’m already using a elementor template shortcode in that gp hook position? Isn’t there a way to apply this only to that particular page id# ?
April 3, 2018 at 9:58 pm #540504Tom
Lead DeveloperLead DeveloperYou could use PHP for that:
<?php if ( is_page( 'your-page-slug' ) ) : ?> <script> jQuery(document).ready(function ($) { $('html, body').scrollTop( 300 ); }); </script> <?php endif; ?>April 5, 2018 at 5:08 pm #542468Carol
<?php if ( is_page( ‘convention-2018’ ) ) : ?>
<script>
jQuery(document).ready(function ($) {
$(‘html, body’).scrollTop( 300 );
});
</script>
<?php endif; ?>Inserted that in the wp_footer hook but it works on ALL pages, not just the https://ncsfa.site/convention-2018/ page. Since we haven’t promoted this yet, I’ll leave it until you see it.
April 9, 2018 at 2:50 pm #545750Carol
Any more thoughts on how to do this?
April 9, 2018 at 9:09 pm #545944Tom
Lead DeveloperLead DeveloperSorry about this! Not sure how I missed your reply.
Did you check the “Execute PHP” checkbox in that hook?
April 10, 2018 at 2:19 pm #546727Carol
That box was hidden. iThemes security had added the disable line in the config file. Tweaked the security, removed the line, logged out, logged back in, checked the box and voila! Working like a champ. You’re the best.
Thanks
April 10, 2018 at 5:14 pm #546819Tom
Lead DeveloperLead DeveloperAwesome, no problem 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.