Help with jquery / javascript show and hide function

Hi Guys,

Any help would be great!!.

I have set up the kind of function that I want on a two test pages. was the first page I set up with bare html. When you click the ‘Click Me’ button the hidden field slides down, then there is another button to make the field slide back up.

On the second page I have implemented the html and css based on my current site design. When you click the ‘Contact’ link its meant to slide down the hidden field like the above already does. However, as you can see from the second page when It doesn’t work!! Even tho I think I’m using the same functions as the first test.

Any idea why my second isn’t working.



You are including jQuery twice on your page and the second one is overwriting the first, causing unexpected behaviour.

Remove the old version (1.3) and move your scripts to the bottom of your page, thus:

    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src="js/jquery.cslider.js"></script>
    <script type="text/javascript" language="javascript">
      $(document).ready(function() {
          $(".target").hide( "slide", { direction: "up"  }, 2000 );

          $(".target").show( "slide", {direction: "up" }, 2000 );

          autoplay    : true,
          bgincrement : 0,
          interval    : 7000  

Also, notice the inclusion of e.preventDefault() which will prevent the links default action.

$(document).ready(function() {});

can be shortened to

$(function() {});

and then since the code is at the bottom of the page where it can run straight away you can then remove the $ from the front to get rid of the microsecond or so wait while it reads the </body></html> tags and the longer delay while it actually tests that those two tags have loaded…