Monday, 15 February 2010

backbone.js - Meteor Backbone Routing Prevent Page Refresh -



backbone.js - Meteor Backbone Routing Prevent Page Refresh -

i'm developing single-page meteor application , i'm handling routing using backbone.js. i'm trying navigate pages carousel, when click menu item in navigation page slide left or right reveal chosen page. however, problem whenever click link entire page reload , interferes carousel transition. want prevent page reloading when click link, angularjs i'm having troubles making work. i'm trying not utilize # links because spiderable meteor bundle says real links visible spiders. have solution?

this html:

<div id="main-navbar" class="navbar"> <div class="navbar-inner rectangle-navbar"> <div class="container"> <ul class="nav"> <li><a href="/">home</a></li> <li><a href="/login">login</a></li> </ul> </div> </div> </div>

and coffeescript:

router = backbone.router.extend routes: "": "main" "login": "login" login: -> slidecarousel 0, false main: -> slidecarousel 1, true approuter = new router meteor.startup -> backbone.history.start pushstate: true slidecarousel = (slideid, visibility) -> $("#content").carousel slideid $('#content').carousel "pause" if visibility == false $("#landing").hide "slow" else $("#landing").show "slow"

try using http://backbonejs.org/#router-navigate navigate instead of direct urls, seek , if works utilize binding event handler:

<li><a href="/" onclick="router.navigate('/');return false;">home</a></li> <li><a href="/login" onclick="router.navigate('/login');return false;">login</a></li>

i'm bit unsure of setup unusual attach url's carousel. have working anywhere in action?

backbone.js meteor

No comments:

Post a Comment