[jQuery] jQmodal cleanup and create new triggers dynamically

[jQuery] jQmodal cleanup and create new triggers dynamically


I'm having a similar issue to this:
http://groups.google.com/group/jquery-en/browse_thread/thread/86568ae1da917536/2684283de38f2abf
The triggers are created dynamically and the modal is initialized with
a callback which passes the offset to display the image that is
clicked. It works fine on first page load but fails when new triggers
are created.
http://meiko.novatunes.com
js code:
var artist_photo_nav_items_per_page = 4;
var artist_photo_gallery_items_per_page = 1;
$(function() {
$(spinner_artist_photo_nav);
get_artist_photos_nav(0,artist_photo_nav_items_per_page);
});
get_artist_photos_nav = function(offset,fans_items_per_page) {
$('#spinner_artist_photo_nav #result').load('ajax/
artist_photo_nav.php',{offset: offset,items_per_page:
fans_items_per_page, network_address: 'meiko', artist_name: 'Meiko'},
init_modal);
}
spinner_artist_photo_nav = function() {
$('#spinner_artist_photo_nav').spinner(10, {
items_per_page: artist_photo_nav_items_per_page,
callback: get_artist_photos_nav
});
}
init_modal = function() {
$('#photo_gallery').jqm({ajax: 'artist_photo_gallery.php',
trigger: '#spinner_artist_photo_nav a.photo_nav', onLoad:
modal_loaded})
}
modal_loaded = function(offset) {
spinner_artist_photo_gallery();
get_artist_photos_gallery(offset,artist_photo_gallery_items_per_page);
}
get_artist_photos_gallery = function(offset,fans_items_per_page) {
$('#spinner_artist_photo_gallery #result').load('ajax/
artist_photo_gallery.php',{offset: offset,items_per_page:
fans_items_per_page, network_address: 'meiko', artist_name: 'Meiko'});
}
spinner_artist_photo_gallery = function() {
$('#spinner_artist_photo_gallery').spinner(10, {
items_per_page: artist_photo_gallery_items_per_page,
orientation: 'horz',
image_prev: 'Themes/Beta/images/arrow-left.png',
image_next: 'Themes/Beta/images/arrow-right.png',
callback: get_artist_photos_gallery
});
}
any help with this would be appreciated,
pb