Skip to content

Instantly share code, notes, and snippets.

@oliverbarnes
Created April 20, 2011 18:18
Show Gist options
  • Save oliverbarnes/932207 to your computer and use it in GitHub Desktop.
Save oliverbarnes/932207 to your computer and use it in GitHub Desktop.
trying to save navigation when clicking on final node's link
<script type="text/javascript" charset="utf-8">
$(function() {
{% if item.root? %}
$.jStorage.flush();
{% endif %}
$('#nav').columnview({
preview: function(element) {
$.jStorage.flush();
if($.browser.msie) {
active1 = $("li").find(".active").first().text();
active2 = $("li").find(".active").last().text();
$.jStorage.set('inpath1', active1 );
$.jStorage.set('inpath2', active2 );
} else {
$.jStorage.set('inpath1', $('a.inpath').first().text());
$.jStorage.set('inpath2', $('a.inpath').last().text());
}
element.click();
}
});
if($.jStorage.get('inpath1')) {
$("a:contains("+$.jStorage.get('inpath1')+")").click();
$("a:contains("+$.jStorage.get('inpath2')+")").click();
$("a:contains("+$.jStorage.get('inpath1')+")").addClass('active');
$("a[href='{{ item.path }}']").addClass('active');
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment