button - Backbone menu refresh handling -


i using yeoman workflow http://yeoman.io/ , have build simple menu layout handle menu css :

var menu = new backbone.layout({ template: "layouts/menu", classname: "menu", events: {       'click a': 'changeactive'      }, changeactive: function(e) { $(e.target).parent().siblings('.active').removeclass('active'); $(e.target).parent().addclass('active'); ... 

it work fine facing problem in bump often, when user clicks on browser's refresh button of course doesn't remember state , display initial state. best way solve ?

  1. you save last selected value cookie or localstorage , inside initialize method make active.
  2. you can update hash , save selected value there. on initialize , make proper menu active.

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -