Answer the question
In order to leave comments, you need to log in
How to update nivoSlider?
Hello! I need to update nivo-slider every n seconds. To do this, you must first delete it, then create it again, but with new pictures (taken from the database). If you can make it easier - tell me how.
The subject itself: how to update the slider?
Tried to implement like this:
$.ajax({<br>
url: '/func/getSlider.php',<br>
success: function (data) {<br>
$('#slider').data('nivoslider').stop();<br>
$('.theme-life').empty().append($('<div id="slider">').addClass('nivoSlider').hover(function () {$('.nivo-directionNav').show()}, function () {$('.nivo-directionNav').hide()}));<br>
var images = $('<img>').attr({src: data[0][0], alt: '###'});<br>
for (var i = 1; i >= data.legth; i++) images = images.add($('<img>').attr({src: data[i][0], alt: '###'}));<br>
$('#slider').append(images).nivoSlider();<br>
}<br>
});<br>
Answer the question
In order to leave comments, you need to log in
Try
j('.slider-wrapper').html('');
j('.slider-wrapper').html(request);
j('#slider').nivoSlider({
effect: 'fade', // Specify sets like: 'fold,fade,sliceDown'
slices: 15, // For slice animations
boxCols: 8, // For box animations
boxRows: 4, // For box animations
animSpeed: 5, // Slide transition speed
pauseTime: 3000, // How long each slide will show
startSlide: 0, // Set starting Slide (0 index)
directionNav: true, // Next & Prev navigation
directionNavHide: true, // Only show on hover
controlNav: false, // 1,2,3... navigation
controlNavThumbs: false, // Use thumbnails for Control Nav
controlNavThumbsFromRel: false, // Use image rel for thumbs
controlNavThumbsSearch: '.jpg', // Replace this with...
controlNavThumbsReplace: '_thumb.jpg', // ...this in thumb Image src
keyboardNav: true, // Use left & right arrows
pauseOnHover: true, // Stop animation while hovering
manualAdvance: false, // Force manual transitions
captionOpacity: 0.8, // Universal caption opacity
prevText: 'Prev', // Prev directionNav text
nextText: 'Next', // Next directionNav text
beforeChange: function(){}, // Triggers before a slide transition
afterChange: function(){}, // Triggers after a slide transition
slideshowEnd: function(){}, // Triggers after all slides have been shown
lastSlide: function(){}, // Triggers when last slide is shown
afterLoad: function(){} // Triggers when slider has loaded
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question