Ok so here is one way to do it, it's not very elegant and needs improvement.
I created a comment view that has a page display which gets NID from url so when ajax calling the content with ajax my/url/89 will return the comments for node 89. This works; even Ajax_Comments are working!
Edit: Ive fixed it so it will cache the data for the user, so when traversing the gallery, it does not load the data ad-nauseum. It stores in .data and pulls it back in if the user has already viewed it.
Anyway, even though this works I feel it needs a lot of improvement and/or different approach. Below is some of the related updated latest code.
$(function(){
// Override the default behavior of all `a` elements so that, when
// clicked, their `href` value is pushed onto the history hash
// instead of being navigated to directly.
$("a.thumb_link").click(function(){
var href = $(this).attr( "rel" );
// Push this URL "state" onto the history hash.
$.bbq.pushState({ image: href });
// Prevent the default click behavior.
return false;
});
// Keep a mapping of url-to-container for caching purposes.
var cache = {
'': $('#gall-default') // If url is '' (no fragment), display this div's content.
};
// Bind a callback that executes when document.location.hash changes.
$(window).bind( "hashchange", function(e) {
// In jQuery 1.4, use e.getState( "url" );
var url = $.bbq.getState( "image" ); //Get State from the above push "image"
// In this example, whenever the event is triggered, iterate over
// all `a` elements, setting the class to "current" if the
// href matches (and removing it otherwise).
$("a.thumb_link").each(function(){
var href = $(this).attr( "rel" );
if ( href === url ) { //Mark the active thumb and launch its content!
$(this).addClass( "current" );
$("#gall-default").css("display","none");
//event.preventDefault();
var $this=this;
$bgimg.css("display","none");
$preloader.fadeIn("fast"); //show preloader
//style clicked thumbnail
$outer_container_a.each(function() {
$(this).children(".selected").css("display","none");
});
$(this).children(".selected").css("display","block");
$outer_container.data("selectedThumb",$this); //get and store next image and selected thumb
$bg.data("nextImage",$(this).next().attr("href"));
$bg.data("newTitle",$(this).children("img").attr("title")); //get and store new image title attribute
itemIndex=getIndex($this); //get clicked item index
lastItemIndex=($outer_container_a.length)-1; //get last item index
$bgimg.attr("src", "").attr("src", $this); //switch image
//set context for node load bits
var node = $(this).attr( "node" );
$("#ajax-div .inner").empty();
if ($(this).data('comm.cachedHtml')) {
$('#ajax-div .inner').html($(this).data('comm.cachedHtml'));
} else {
var toLoad = $(this).attr('node');// Get the URL of the clicked link.
$.ajax({ // Now load the content
url: toLoad,
cache: true,
beforeSend: function () {
$("#preloader2").fadeIn("fast");
},
success: function(data) {
$('#ajax-div .inner').html($('#content', data));// Inject new content
$("#preloader2").fadeOut("fast");
$(this).data('comm.cachedHtml', data);
Drupal.attachBehaviors('#ajax-div .inner');
}
});
}
} else { //Un-Mark Thumb & other deselecting
$(this).removeClass( "current" );
}
});
//do something here..
});
// Since the event is only triggered when the hash changes, we need
// to trigger the event now, to handle the hash the page may have
// loaded with.
$(window).trigger( "hashchange" );
});