One piece of javascript after the blog is loaded
-
Hello everyone,
I would not call myself a complete rookie in WP matters, but obviously my understanding of javascript lacks and the WP hook system lacks some major basics:
I have a Twenty Eleven child theme and want to add one single piece of Javascript after the page is loaded:
window.scrollBy(0,125);
At least when I try it out in Firefox Javascript Environment it works. It is supposed to scroll the page a little after it is loaded.
What I thought was necessary to achieve this goal is adding
<? function ScrollOnLoad() { ?> <script type="text/javascript"> window.scrollBy(0,125); </script> <?php } add_action('wp_head', 'ScrollOnLoad'); ?>
to my child functions.php. I also tried wp_loaded and after_setup_theme (with catastrophic results) as hooks.
Well, it does nothing. Any ideas? At least it is in the head section of the code now, so technically this is a javascript question I suppose…
Thank you all!
Andreas
- The topic ‘One piece of javascript after the blog is loaded’ is closed to new replies.