You probably want to use the Sammy RenderContext render() method:
this.get('#/item/:id', function(context) { this.item = this.items[this.params['id']]; if (!this.item) { return this.notFound(); } this.render('templates/item_detail.template').then(function(content) { $.fancybox({ content: content,
EDIT As @drozzy pointed out, the location bar will still be modified using this method. To get around this behavior, we need to grab a click on the link that should open a popup window and explicitly launch Sammy's route:
$(document).delegate("a[href^=#/item/]", "click", function(linkElement) { // Determine and explicitly start Sammy route for the clicked link var path = linkElement.currentTarget.href.replace(/^[^#]*/, ""); Sammy('#main').runRoute('get', path); // cancel the default behaviour return false; });
Note that this example uses links matching the selector, with routes starting with #/item/ . If this is not specific enough, there should probably be something more suitable, for example. marker classes.
(This uses jQuery 1.4.3, as used in the JSON Store demo.)
Julian D.
source share