ottmance
Forum Replies Created
-
Forum: Hacks
In reply to: Using a jQuery accordian on a widget.Ok so i put the wp_enqueue_script(‘jquery-ui-accordion’); right near the beginning of my form method in my widget. Figured it belonged there over anywhere else because that the code that draws the frontend where i want the accordion section.
I then dropped this in:
<div id="accordion"> <h3>Section 1</h3> <div> <p> Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate. </p> </div> <h3>Section 2</h3> <div> <p> Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In suscipit faucibus urna. </p> </div> </div>
That just ends up rendering out normally with no accordion happening.
So I’m missing something, but what?
Is my id on the opening <div> wrong? If not then what is right?
I’ve seen reference to needing some javascript to get things going that looks like this
<script> (function(){ jQuery("#accordion").accordion(); })(); </script>
I’ve put this in my form method both before and after the section that i want to accordion and it doesn’t make a difference so i’m still lost.
Thanks
Chuck