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

Photoboxeffect -possible to manipulate the init-function with AJAX?

Expand Messages
  • roblj689
    If I get a new image adress from my database, and want to add it to the init-function dynamically (with AJAX) to display it in the photoboxeffect. How do I do
    Message 1 of 5 , Sep 3, 2007
    • 0 Attachment
      If I get a new image adress from my database, and want to add it to
      the init-function dynamically (with AJAX) to display it in the
      photoboxeffect. How do I do this, is it even possible to add new ones
      this way?

      function init() {
      YAHOO.example.container.photobox = new
      YAHOO.widget.PhotoBox("photobox",
      {
      effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.45},
      fixedcenter:true,
      constraintoviewport:true,
      underlay:"none",
      close:true,
      visible:false,
      draggable:true,
      modal:true,

      photos:[{src:"http://static.flickr.com/51/129586913_e78683c466.jpg",caption:"Linus"},

      {src:"http://static.flickr.com/50/129590195_0642f2d96a.jpg",caption:"Linus
      2"},

      {src:"http://static.flickr.com/8/12669712_be928a0d97.jpg",caption:"Dobb's
      Ferry, NY"}

      ],
      width:"500px"
      } );
      YAHOO.example.container.photobox.render();

      YAHOO.util.Event.addListener("show", "click",
      YAHOO.example.container.photobox.show,
      YAHOO.example.container.photobox, true);
    • Satyen Desai
      Hi, You wouldn t actually need to manipulate the init function. You should be able to set the list of photos at any time, using the cfg property. So in your
      Message 2 of 5 , Sep 7, 2007
      • 0 Attachment
        Hi,
        You wouldn't actually need to manipulate the init function. You should be able to set the list of photos at any time, using the cfg property. So in your AJAX response handler, you'd have a line which did this:

            YAHOO.example.container.photobox.cfg.setProperty("photos", [ {src:urlFromDB_1, caption:captionFromDB_1}, {src:urlFromDB_2, captionFromDB_2} ... ]);

        Hope that helps,
        Satyen


        ----- Original Message ----
        From: roblj689 <robert.ljungwald@...>
        To: ydn-javascript@yahoogroups.com
        Sent: Monday, September 3, 2007 10:06:38 AM
        Subject: [ydn-javascript] Photoboxeffect -possible to manipulate the init-function with AJAX?

        If I get a new image adress from my database, and want to add it to
        the init-function dynamically (with AJAX) to display it in the
        photoboxeffect. How do I do this, is it even possible to add new ones
        this way?

        function init() {
        YAHOO.example. container. photobox = new
        YAHOO.widget. PhotoBox( "photobox" ,
        {
        effect:{effect: YAHOO.widget. ContainerEffect. FADE,duration: 0.45},
        fixedcenter: true,
        constraintoviewport :true,
        underlay:"none" ,
        close:true,
        visible:false,
        draggable:true,
        modal:true,

        photos:[{src: "http://static. flickr.com/ 51/129586913_ e78683c466. jpg",caption:"Linus" },

        {src:"http://static. flickr.com/ 50/129590195_ 0642f2d96a. jpg",caption:"Linus
        2"},

        {src:"http://static. flickr.com/ 8/12669712_ be928a0d97. jpg",caption:"Dobb' s
        Ferry, NY"}

        ],
        width:"500px"
        } );
        YAHOO.example. container. photobox. render();

        YAHOO.util.Event. addListener( "show", "click",
        YAHOO.example. container. photobox. show,
        YAHOO.example. container. photobox, true);




        Ready for the edge of your seat? Check out tonight's top picks on Yahoo! TV.
      • roblj689
        Thanks a lot! This is exactly what I was looking for! :D
        Message 3 of 5 , Sep 13, 2007
        • 0 Attachment
          Thanks a lot! This is exactly what I was looking for! :D
        • roblj689
          If I don t know how many pictures I want to add, and want to add them dynamically as before. How can I implement this? I have the following code, //global
          Message 4 of 5 , Sep 14, 2007
          • 0 Attachment
            If I don't know how many pictures I want to add, and want to add them
            dynamically as before. How can I implement this?

            I have the following code,

            //global variables
            var clicklist = new Array(100);
            var currentpicture = null;
            var index = 0;


            function addToClicklist() {

            clicklist[index] = currentpicture;
            YAHOO.example.container.photobox.cfg.setProperty("photos", [
            {src:clicklist[index], caption:"test"}]);
            index = (index + 1);
            }

            But that only shows one picture in the photobox, and without the back
            and forward arrows, strange?

            I have tried something like,

            YAHOO.example.container.photobox.cfg.setProperty("photos", [
            for (var i = 0; i < clicklist.length; i ++) {
            {src:clicklist[i], caption:"test"},
            }
            {src:clicklist[index] , "captionFromDB_2"} ]);


            The page for the first example you can find at
            http://www-und.ida.liu.se/~roblj689/www/index.php/application/index/1#
          • Ken Robinson
            A few months ago, I posted about problems I was having with my event calendar script. I overcame those problems and I have the script almost done. The script
            Message 5 of 5 , Sep 14, 2007
            • 0 Attachment
              A few months ago, I posted about problems I was having with my event
              calendar script. I overcame those problems and I have the script almost done.

              The script can be found at
              <http://www.nnjsda.org/year_cal.2.3.0.php>. I use both YUI & Google maps.

              There are still a few lingering problems:
              1) The buttons on the "Year View" and the single month view do not
              look alike. The button that is different is a "link" button.

              2) In FF2, the straight lines on the yearly calendar and in the
              large month calendar are distorted by about 1 or 2 pixels in the
              middle of the display. Almost as thought something is bleeding through.

              3) in FF the cursor doesn't show in one of the forms (bring up an
              event, press "Show Map" and then press the "Get Directions" button.
              But the cursor does show in the form that is brought up when you
              press "Send Comments"

              4) After displaying the directions as generated by Google Maps and
              then closing the directions, map, and event windows, some of the
              previous clickable links on the Monthly view are nolonger clickable
              (I think they are all on the left side of the displayed window).

              5) The page currently doesn't display is MSIE, but it did earlier
              today, so that's my problem with something I changed today. :-) It
              acts like there is a Javascript error, but MSIE7 doesn't report one.

              Take a look...

              I have another site that also uses both YUI and Google Maps --
              <http://www.hurricane-track.com/>. YUI for the buttons and Google
              Maps to for the storm tracks. No problems with this one.

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