Loading ...
Sorry, an error occurred while loading the content.

Referencing my Carousels via Javascript

Expand Messages
  • craigdscribner
    I want to have some control buttons above my Carousels that can remove all the carousel items and replace them with new ones, change the size and the
    Message 1 of 4 , Dec 4, 2008
    • 0 Attachment
      I want to have some control buttons above my Carousels that can remove
      all the carousel items and replace them with new ones, change the size
      and the visibilityNum.

      I can see how to do all these things when I load the page initially,
      but I don't know how to reference and change them later on.

      For example, if I insert an HTML button on the page that says
      onclick="carousel.removeItem(0)" I get a javascript error saying what
      the heck is a carousel?

      I realize that the carousel I want is contained in a div called
      Container. But I still can't figure out a way to make something like
      this work:
      "document.getElementById('container').carousel.removeItem(0)". Again,
      it says thet carousel is undefined.

      Can you offer some guidance? thanks!
    • Karr, David
      I m not an authority, but the simple answer is just to set the effect field in the animation property. The default is YAHOO.util.Easing.easeOut . I
      Message 2 of 4 , Dec 5, 2008
      • 0 Attachment
        I'm not an authority, but the simple answer is just to set the "effect" field in the "animation" property.  The default is "YAHOO.util.Easing.easeOut".  I think, and I'm not at all certain, that the "effect" object could be a constructed "YAHOO.util.Anim" object, which gives you a great deal of flexibility.  Look at the Animation documentation and examples for more detail.


        From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of craigdscribner
        Sent: Thursday, December 04, 2008 2:44 PM
        To: ydn-javascript@yahoogroups.com
        Subject: [ydn-javascript] Referencing my Carousels via Javascript

        I want to have some control buttons above my Carousels that can remove
        all the carousel items and replace them with new ones, change the size
        and the visibilityNum.

        I can see how to do all these things when I load the page initially,
        but I don't know how to reference and change them later on.

        For example, if I insert an HTML button on the page that says
        onclick="carousel. removeItem( 0)" I get a javascript error saying what
        the heck is a carousel?

        I realize that the carousel I want is contained in a div called
        Container. But I still can't figure out a way to make something like
        this work:
        "document.getElemen tById('container ').carousel. removeItem( 0)". Again,
        it says thet carousel is undefined.

        Can you offer some guidance? thanks!

      • gopalarathnam_v
        ... The YUI Carousel offers a static method getById that can be used to get the instance of the Carousels in your page. For example, assuming you have two
        Message 3 of 4 , Dec 5, 2008
        • 0 Attachment
          --- In ydn-javascript@yahoogroups.com, "craigdscribner" <craig.scribner@...> wrote:
          >
          > I want to have some control buttons above my Carousels that can remove
          > all the carousel items and replace them with new ones, change the size
          > and the visibilityNum.
          >
          > I can see how to do all these things when I load the page initially,
          > but I don't know how to reference and change them later on.
          >
          > For example, if I insert an HTML button on the page that says
          > onclick="carousel.removeItem(0)" I get a javascript error saying what
          > the heck is a carousel?
          >
          > I realize that the carousel I want is contained in a div called
          > Container. But I still can't figure out a way to make something like
          > this work:
          > "document.getElementById('container').carousel.removeItem(0)". Again,
          > it says thet carousel is undefined.
          >
          > Can you offer some guidance? thanks!
          >

          The YUI Carousel offers a static method "getById" that can be used to get the instance of
          the Carousels in your page. For example, assuming you have two Carousels in your page
          with element IDs viz., "carousel1" and "carousel2", then:

          // the following call returns the Carousel instance "carousel1"
          var carousel1 = YAHOO.widget.Carousel.getById("carousel1");
          // you can use any YUI Carousel method on carousel1 now
          // carousel1.removeItem(0);

          Similarly, passing "carousel2" returns the instance of the second Carousel (that has the ID
          - carousel2).

          --
          Gopal Venkatesan
          http://g13n.in/

          Note: if you see question marks (?????) after my name in the From header, then your mail
          tool is not Unicode enabled! You should see my name (Gopal Venkatesan) in Hindi (गोपाल
          वेंकटेसन)
        • Scribner, Craig
          Thank you Gopal! That works! From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of gopalarathnam_v Sent: Friday, December
          Message 4 of 4 , Dec 5, 2008
          • 0 Attachment

            Thank you Gopal! That works!

             

            From: ydn-javascript@yahoogroups.com [mailto:ydn-javascript@yahoogroups.com] On Behalf Of gopalarathnam_v
            Sent: Friday, December 05, 2008 12:47 PM
            To: ydn-javascript@yahoogroups.com
            Subject: [ydn-javascript] Re: Referencing my Carousels via Javascript

             

            --- In ydn-javascript@yahoogroups.com, "craigdscribner" <craig.scribner@...> wrote:

            >
            > I want to have some control buttons above my Carousels that can remove
            > all the carousel items and replace them with new ones, change the size
            > and the visibilityNum.
            >
            > I can see how to do all these things when I load the page initially,
            > but I don't know how to reference and change them later on.
            >
            > For example, if I insert an HTML button on the page that says
            > onclick="carousel.removeItem(0)" I get a javascript error saying
            what
            > the heck is a carousel?
            >
            > I realize that the carousel I want is contained in a div called
            > Container. But I still can't figure out a way to make something like
            > this work:
            > "document.getElementById('container').carousel.removeItem(0)".
            Again,
            > it says thet carousel is undefined.
            >
            > Can you offer some guidance? thanks!
            >

            The YUI Carousel offers a static method "getById" that can be used to get the instance of
            the Carousels in your page. For example, assuming you have two Carousels in your page
            with element IDs viz., "carousel1" and "carousel2", then:

            // the following call returns the Carousel instance "carousel1"
            var carousel1 = YAHOO.widget.Carousel.getById("carousel1");
            // you can use any YUI Carousel method on carousel1 now
            // carousel1.removeItem(0);

            Similarly, passing "carousel2" returns the instance of the second Carousel (that has the ID
            - carousel2).

            --
            Gopal Venkatesan
            http://g13n.in/

            Note: if you see question marks (?????) after my name in the From header, then your mail
            tool is not Unicode enabled! You should see my name (Gopal Venkatesan) in Hindi (गोपाल
            वेंकटेसन)

          Your message has been successfully submitted and would be delivered to recipients shortly.