Comparison between Sammy.js/History.js/Nav.js [closed]

三世轮回 提交于 2019-12-09 06:42:48

问题


I was looking around for Single Page navigation handlers. Sammy.js was bit okay to crack so i created a sample SPA with proper navigation. Works great till now.(moreover, the fact the sammy.js is used by Twitter.. made me more curious.. ) :)

No issues!!

Looked around for alternative's and found History.js and Nav.js to be in same line.

History.js-- Follow the HTML5 History API as much as possible Provide a cross-compatible experience for all HTML5 Browsers (they all implement the HTML5 History API a little bit differently causing different behaviours and sometimes bugs - History.js fixes this ensuring the experience is as expected / the same / great throughout the HTML5 browsers)

Nav.js -- allows you to manage page-based navigation by binding the left and right arrow keys.

Sammy.js -- Like Sinatra, a Sammy application revolves around 'routes'. Routes in Sammy are a little different, though. Not only can you define 'get' and 'post' routes, but you can also bind routes to custom events triggered by your application.

All seems good in definition.


回答1:


My point of view here is following (I like sammy.js, so I'm biased here, nothing objective just an opinion).

History.js is all in HTML5 - so it crosses out all the support of IE8 and bellow. That is sometimes acceptable and, however, sometimes - not. Moreover, I am not completely sure that between gecko, trident, webkit - major browser engines - they all support that HTML5 history spec all the way without any differences.

So for me History.js is all out. Then we have to differ between Nav.js and Sammy.js; and I don't see this as a competition. You ONLY have keyboard based navigation in Nav.js and since there is not much projects that don't use jQuery anymore, you can achieve that in Sammy.js by using http://api.jquery.com/category/events/keyboard-events/ and special routes for special events meaning next/previous page or whatever else floats your goat.

Sammy.js is lightweight, efficient, scalable, reusable and fully cross-browser compatible.



来源:https://stackoverflow.com/questions/13918770/comparison-between-sammy-js-history-js-nav-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!