Submit Your Article Forum Rules
Results 1 to 4 of 4

Thread: Jquery UI

  1. #1

    Jquery UI

    I haven't been here in awhile but hoping that someone can help me out with something that should be simple. I'm trying to use Jquery UI for the first time. I am using Google's hosted API library and just copied the "accordian" code from the Jquery site but can't get it to work. I don't know if the problem is with my linkage to the google library (I've been playing around with this a bit) or with the code itself. here it is below:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>

    <script src="" type="text/javascript"></script>
    <script src="" type="text/javascript"></script>

    $(function() {
    $( "#accordion" ).accordion();

    <DIV class=demo>
    <DIV id=accordion>
    <H3><A href="#">Section 1</A></H3>
    <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><A href="#">Section 2</A></H3>
    <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>
    <H3><A href="#">Section 3</A></H3>
    <P>Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis. Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui. </P>
    <LI>List item one</LI>
    <LI>List item two</LI>
    <LI>List item three</LI></UL></DIV>
    <H3><A href="#">Section 4</A></H3>
    <P>Cras dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia mauris vel est. </P>
    <P>Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </P></DIV></DIV></DIV><!-- End demo -->
    <DIV style="DISPLAY: none" class=demo-description>
    <P>Click headers to expand/collapse content that is broken into logical sections, much like tabs. Optionally, toggle sections open/closed on mouseover. </P>
    <P>The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is usable without JavaScript. </P></DIV><!-- End demo-description -->

    Can someone take a look and see if it's my link to google or something in the code that I have to change? Thank you

  2. #2
    I assume you are talking about this:

    If so, it looks like your event is starting before the page is ready.

    Have you tried:

    jQuery(document).ready(function(){ $('#accordion').click(function() { $(this).next().toggle(); return false; }).next().hide();});

    <edit>It also looks like you are missing the js files for the jqueryUI itself</edit>

  3. #3
    Thanks Rah, I think you were right.. I moved the script into the head section. I also added the Google hosted style sheet but I think it was the first correction that did it:

    <link href="" rel="stylesheet" type="text/css"/>
    <script src=""></script>
    <script src=""></script>

    Thanks for your help!

  4. #4
    I'm glad you got it working.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts