When you bind colorbox to $(document).ready() as follows:
$("a.usr").colorbox({width:"960px", height:"90%", iframe:true});
jQuery goes to search the page, takes everything that matches a.usr , binds the colorbox to these elements, and then forgets everything about a.usr . jQuery will not remember that you are interested in a.usr , so the new ones will not be colorbox'd.
A common solution of this kind is to use .live() or .delegate() , but they will not work here because there is no colorbox event.
However, you can easily link the colorbox manually. Try changing loadMore to something more:
function loadMore(pageNo) { $.get('/search/resultsAjax', { page: pageNo }, function(response) { var $html = $(response); $html.find('a.usr').colorbox({ width: '960px', height: '90%', iframe: true }); $('#results').append($html); }; }
You simply turn the response HTML into a jQuery object, find all a.usr things in it, bind the colorbox to them, and then paste the new HTML into the DOM, as usual.
mu is too short
source share