How to apply jQyery effect of hide and show in Drupal?

0 votes
asked by (140 points)
edited by

How to apply jQyery effect of hide and show in Drupal?

$("#hide").click(function(){
  $("body").hide();
});

$("#show").click(function(){
  $("body").show();
});

1 Answer

0 votes
No avatar answered by (193k points)

You can use the following jQuery code:

$(".hideshow").click(function(){
  $(this).next().slideToggle("slow");
  return false;
}).next().hide();

then use the script method for the element you want to hide:

<script type="text/javascript">
$(document).ready(function(){
  $(".hideshow").click(function(){
    $(this).next().slideToggle("slow");
    return false;
  }).next().hide();
});
</script>

You can define the toggle function and name it as you want.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register
...