Hi guys,

I am new to JQuery so sorry if I don't get it... but how do I add JQuery to a block? I have the latest JQuery UI module installed and I have a code written that I want displayed in a block. This is the code:





Accordion Using jQuery

$(document).ready(function() { //hide the all of the element with class msg_body $(".msg_body").hide(); //slides the element with class "msg_body" when paragraph with class "msg_head" is clicked $("#firstpane p.msg_head").click(function() { $(this).next("div.msg_body").slideToggle(700).siblings("div.msg_body").slideUp("slow"); }); //slides the element with class "msg_body" when mouse is over the paragraph $("#secondpane p.msg_head").mouseover(function() { $(this).next("div.msg_body").slideDown("slow").siblings("div.msg_body").slideUp("slow"); }); }); body { margin: 10px auto; font: 75%/120% Verdana,Arial, Helvetica, sans-serif; } p { padding: 0 0 1em; } .msg_list { list-style: none; margin: 0; padding: 0; width: 200px; } .msg_head { padding: 5px 10px; cursor: pointer; position: relative; background-color:#3cfb34; margin:1px; } .msg_body { padding: 5px 10px 15px; background-color:#F4F4F8; }


Put your mouse over each head to toggle the new elements

Today's Events

orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit

New Places For Rent

orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit

Test

orem ipsum dolor sit amet, consectetuer adipiscing elit orem ipsum dolor sit amet, consectetuer adipiscing elit


So I just want to know how to display this in a block. Where do I add the add drupal js command?

Also, I should probably mention that the blocks I want displayed are associated with Views, so those settings willl need to be displayed as well.

Thanks for the help!

Comments

nevets’s picture

You might want to check out the Views Accordion module.