tags:

views:

436

answers:

1

I'm trying to get the next/previous buttons to work with SLIMBOX gallery after using an AJAX call to dynamically load content.

$(document).ready(function() {

$('.content_box').hide();
$('.sf-menuUP a').click(function(){
$('.content_box').fadeIn('slow');
});

var hash = window.location.hash.substr(1);
var href = $('.sf-menuUP li a').each(function(){
 var href = $(this).attr('href');
 if(hash==href.substr(0,href.length-5)){
  var toLoad = hash+'.html #content';
  $('#content').load(toLoad)
 }           
});

$('.sf-menuUP li a').click(function(){

 var toLoad = $(this).attr('href')+' #content';
 $('#content').fadeOut('fast',loadContent);
 $('#load').remove();
 $('#wrapper').append('<span id="load">LOADING...</span>');
 $('#load').fadeIn('normal');
 window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
 function loadContent() {
  $('#content').load(toLoad,'',showNewContent())
 }
 function showNewContent() {
  $('#content').fadeIn('normal',hideLoader());
 }
 function hideLoader() {
  $('#load').fadeOut('normal');
 }
 return false;
});
$("a[rel^='lightbox']").livequery(function(){ 
    $(this).slimbox({/* Put custom options here */}, null, function(el) {
                return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
    }), function() {
        //remove slimbox? this is called when elements no longer match
    }
});

});

The slimbox gets rebound with livequery, I just don't know how to rebind the next/previous functions of slimbox. I hope this is enough info to go on, I really need to get this working. Thanks.

A: 

You can find a simple example of previous/next function with ajax in http://www.twozao.com/2010/06/previous-next-functionality-with-php.html. I think this will be helpful to you.

Goysar