Created
June 15, 2012 10:23
-
-
Save hustKiwi/2935751 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 没有依赖Backbone的History机制,而是调用Native命令实现页面切换, | |
| // 由Native来统一管理History。 | |
| $(document).on('click', 'a, .url', function(e) { | |
| e.preventDefault(); | |
| var pattern = /#!(.+)/, | |
| $this = $(this), | |
| href = $this.attr('href') || $.this.data('url'); | |
| if (href && href.match(pattern)) { | |
| Crab.createView({ action: href }); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment