• Resolved MeltingDog

    (@meltingdog)


    Hi all,

    I tried searching for a similar thread but couldnt come accross anything that helped so I apologise if this has been answered before.

    What I am trying to do is run a simple JQuery script within a WP page. It simply slides one image down to reveal one behind it. Currently the images show in the correct place in the correct order (so css is fine) but no animation happens.

    I have the script running fine on it own page but nothing happens when I copy it into WP.

    Heres my HTML:

    <div class="imageswapwrap">
    	<img src="https://localhost/wpeido/wp-content/uploads/2011/09/image1.jpg" />
        	<img src="https://localhost/wpeido/wp-content/uploads/2011/09/image2.jpg" class="frontimage" />
    	</div>

    And my JQuery SCript which is on its own file:

    $(function(){
    	$('.imageswapwrap').hover(function() {
    		$(this).children('.frontimage').stop().animate({"top" : "300px"}, 700);
    	}, function(){
    		$(this).children('.frontimage').stop().animate({"top" : "0px"}, 400);
    		});
    });

    And in my header I have:

    <script language="JavaScript" SRC="<?php echo bloginfo('template_directory') ?>scripts/jQuery-1.6.3.pack.js"></script>
    <script src="<?php echo bloginfo('template_directory') ?>scripts/imageswapscript.js" type="text/javascript"></script>

    (note: I am calling my own JQuery library as well as the built in wp one).

    Any help would be much appreciated! Thanks heaps!

Viewing 6 replies - 1 through 6 (of 6 total)
  • We will need to see your webpage, so please let us know your webpage url.

    It would be very possible that your jquery is crashed so change this jquery code:

    $(function(){

    to

    jQuery(function($){

    Thread Starter MeltingDog

    (@meltingdog)

    Hi Geeksfolder

    Here is my link:

    https://www.eido.com.au/test-page/

    Like I said, the desired out come is meant to be that the first image slides down to reveal one behind it.

    I also tried changing
    $(function(){

    to

    jQuery(function($){

    to no avail
    Thanks!

    Hey MeltingDog,

    The link is broken…

    Thread Starter MeltingDog

    (@meltingdog)

    Sorry it was set to private. Try now

    Hey I see you have missed a slash (/) in front of scripts folder name.

    You wrote:

    <script language="JavaScript" SRC="<?php echo bloginfo('template_directory') ?>scripts/jQuery-1.6.3.pack.js"></script>
    <script src="<?php echo bloginfo('template_directory') ?>scripts/imageswapscript.js" type="text/javascript"></script>

    but needs to be:

    <script language="JavaScript" SRC="<?php echo bloginfo('template_directory') ?>/scripts/jQuery-1.6.3.pack.js"></script>
    <script src="<?php echo bloginfo('template_directory') ?>/scripts/imageswapscript.js" type="text/javascript"></script>

    Let’s try this and see how it goes.

    Thread Starter MeltingDog

    (@meltingdog)

    Ahhhhh… epic fail on my be-half! Thanks so much geeks! Works fine now! Just needed to open my eyes a bit more!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘JQuery in page – help please’ is closed to new replies.