jQuery的移动Backbone.js的路由 [英] jquery-mobile backbone.js routing

查看:109
本文介绍了jQuery的移动Backbone.js的路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Backbone.js的/ jQuery Mobile的应用程序:

I have a backbone.js / jquery mobile app:

当我做一个GET到mydomain.com/#map~~V,然后jQuery的执行/,然后加载#map。

when i make a GET to mydomain.com/#map, then jquery executes "/" and then loads #map.

由于/首先引发,Backbone.js的所有脚本加载,包括我的地图controller.js的Backbone.js的路线(图:functionForMapRoute)。
由于网址中包含/#图,Backbone.js的路线图被前jQuery Mobile的已呈现的DOM触发。

because "/" is triggered first, all backbone.js scripts are loaded including the backbone.js routes in my map-controller.js ("map": "functionForMapRoute"). since the URL contains /#map, the backbone.js route "map" gets triggered before jquery mobile has rendered the dom.

所以functionForMapRoute不容于div的操作导致DOM isn't在这一点上满载。

so "functionForMapRoute" can´t operate on divs cause the DOM isn´t fully loaded at this point.

我怎么能保证,该地图路由触发直到DOM满载?

how can i ensure, that the "map" route is triggered not until the DOM is fully loaded?

推荐答案

使用更多的东西整合使用jQuery Mobile,例如的 jquerymobile路由器(你可以找到它在github)。它取代了骨干路由器,它是用jQuery Mobile的使用,Backbone.js的或spine.js

use something more integrated with jquery mobile, for instance jquerymobile-router (you can find it on github). It replaces backbone's router and it's to be used with jquery mobile and backbone.js or spine.js

这篇关于jQuery的移动Backbone.js的路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆