• Stefan

    (@webcam)


    Hello Community!

    I would use the moo-tools slider effect in my loop.

    In header.php

    <script type="text/javascript">
    		window.onload = function() {
    		    var topbar = document.getElementById('newsbox');
    		    topbar.style.height = 20 + "px";
    
    		}
    
    	</script>

    in my loop:

    <?php   $my_query = new WP_Query('category_name=news&showposts=3');
     while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID; ?>
    
    <div id="newsbox" onmouseover="scale_<?php the_ID(); ?>.sizeup()" onmouseout="scale_<?php the_ID(); ?>.sizedown(20)">
    
    <div class="content">
    								 <script type="text/javascript">scale_<?php the_ID(); ?> = new fx.Scaleheader('newsbox', {duration: 300});   </script>
    	CONTENT
    </div></div>
    
    <?php endwhile; ?>

    THIS WILL WORK FINE: with Firefox.

    But it wont work with Safari and Opera. These both will only slide up the first entry.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I am having a similar problem, but using the thumbnailviewer II script inside of the post loop. It works fine in Firefox/ Safari, but anything with the js (for example, images with rel=””) won’t show up at all in IE (the whole div just disappears, even the images without javascript in the tags)

    Is there some issue with calling javascript from inside the WP loop (I am using it outside of the content box, in the template, but still inside of the loop)

    I am having a slightly different situation – for each post and page I want to apply in the <head> section specific <script> and <Link> tags – so each posting or page can have specific formatting/styling and or operational features/widgets.

    I know I can add some of these <scripts> and <links> to the header.php file but that is not fine-grained enough.

    It appear wp_head() might be useful – but I don’t know how to make that call specific to a particular post or page.

    Any suggestions would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘<?php the_ID(); ?>, javascript and the loop’ is closed to new replies.