Experimented some more:

When I add

opts.addSlide(ddblockGetSlideHTML(data.slideImg), fwd == false);

The images are appended after the other images, but still not in the
slideExpr

When I add

opts.$cont = '#ddblock-' + opts.ddblocknr + ' .ddblock-container';

before the addslide

It puts the slide in the content container I want but after adding one
slide the slideshow stops

Anyone having suggestion how to append slides with addSlide in the
parent of the container defined with slideExpr

Thanks

Philip Blaauw



On Apr 14, 7:30 am, ppblaauw <ppbla...@gmail.com> wrote:
> Maybe the issue is really addSlide in combination with slideExpr.
>
> When images are added they are prepended instead of appended.
>
> So the issue will be how to use slideExpr with addSlide.
>
> If more info is needed, please let me know
>
> On Apr 13, 8:12 am, ppblaauw <ppbla...@gmail.com> wrote:
>
> > I read a lot of posts about this issue, but can not find a solution.
> > Also have seen the addSlide examples for the jQuerycycleplugin.
>
> > I try to add slides to thecycleplugin with AJAX, one slide at a time
> > with the following code.
>
> >   function onBefore(curr, next, opts, fwd) {
> >     // on Before arguments:
> >     //  curr == DOM element for the slide that is currently being
> > displayed
> >     //  next == DOM element for the slide that is about to be
> > displayed
> >     //  opts == slideshow options
> >     //  fwd  == true if cycling forward, false if cycling backward
>
> >     //Slide html creation helper.
> >     function ddblockGetSlideHTML(slideImg) {
> >       return '<img src="' + slideImg + '" width="200" height="200"
> > alt=""/>';
> >     };
>
> >     opts.ajaxLoadSlides = 1; // Will be set later from UI
> >     opts.totalSlideCount = 6; //Will be set later from UI
> >     //load slides dynamically
> >     if (opts.ajaxLoadSlides) {
>
> >       // on the first pass, addSlide is undefined (pluginhasn't yet
> > created the fn);
> >       // when we're finshed adding slides we'll null it out again
> >       if (!opts.addSlide){
> >         return;
> >       }
>
> >       if (opts.nextSlide + 1 == opts.totalSlideCount) {
> >         // final slide in our slide slideshow is about to be displayed
> >         // so there are no more to fetch
> >         alert('last slide to be dislayed, nothing to add anymore');
> >         opts.addSlide = null;
> >         return;
> >       }
>
> >       // Retrieve slide from server via AJAX, call; if successful the
> >       // anonymous function in voteSaved is run.
> >       $.ajax({
> >         type: 'POST', // Use the POST method.
> >         url: 'get_image_slides',
> >         dataType: 'json',
> >         data:
> > {js:true,origin:'ddblock',curr_slide:opts.currSlide,next_slide:opts.nextSli 
> > de,delta:opts.ddblocknr},
> >         success: function(data) {
> >           // add our next slide
> >           opts.addSlide(ddblockGetSlideHTML(data.slideImg), fwd ==
> > true);
> >         },
> >         error: function(xhr) {
> >           //alert('Error: ' + xhr.status + ' ' + xhr.statusText);
> >         }
> >       });
> >     }
> >   }
>
> > I first have 2 initial images
> > after that, images are loaded with AJAX
> > The ajax call returns the image ok
> > The problem is that opts.currSlide and opts.Nextslide give strange
> > values so the wrong images are selected.
> > When I look in FF console the post values for currSlide and nextSlide
> > are.
>
> > 0 - 1
> > 2 - 1
> > 2 - 3
> > 4 - 1
> > 2 - 3
> > 4 - 5
>
> > I get the images in the PHP script on nextSlide +2
> > So i expect :
> > 0 - 1 -> get image 3
> > 1 - 2 -> get image 4
> > 2 - 3 -> get image 5
> > 3 - 4 -> get image 6
>
> > Another problem is I use slideExpr to select the right content to
> > slide.
> > How can I you use addslide to add slides to the SlideExpr.parent
>
> > Thanks in advance for any help with this issue
>
> > Philip Blaauw

Reply via email to