Partial.js Client-side Routing (client-side routing-History API based on HTML5 Spa features)

Source: Internet
Author: User

Partial.js Client-side Routing

Https://github.com/petersirka/partial.js-clientside

The Framework supports the HTML 5 history APIs, for older browsers (ie8+) URLs hashtag is automatically enabled. This plugin was a Little Big cannon for the Web development. Works with JQuery.

  • Easy-to-use
  • Minified only 9.5 KB (without GZIP compression)
  • Great functionality
  • Great use
  • Works in IE 8+
  • No dependencies
  • DEMO EXAMPLE

Compact and easy to use powerful, good compatibility, for the old browser, that does not support the HTML5 SPA history API Browser, automatically degraded to hash route.

To view the example page:

http://source.858project.com/contact/

Simple example
// ===========================DEFINE ROUTING// ===========================Framework = = = Global variableFramework.Route'/homepage/', View_homepage, [' Contact‘]);Framework.Route'/services/', View_services, [' Contact‘]);Framework.Route'/contact/', View_contact, [' Empty‘]);Framework.Route'/products/{category}/', View_products, [' Latest‘]);// ===========================DEFINE PARTIAL CONTENT// ===========================Framework.Partial' Contact‘,function () {$(' #panel‘).html' PANEL Contact‘);});Framework.Partial' Empty‘,function () {$(' #panel‘).html' PANEL EMPTY‘);});Framework.Partial' Latest‘,function () {$(' #panel‘).html' PANEL LATEST‘);});// ===========================DEFINE views// ===========================functionView_homepage () {$(' #content‘).html' Homepage‘);}functionView_services () {$(' #content‘).html' SERVICES‘);}functionView_contact () {$(' #content‘).html' Contact‘);}functionView_products (category) {$(' #content‘).html' Products–>‘+ category);}// ===========================DEFINE EVENTS// ===========================Framework.On' Ready‘,function () {$('. Menu‘).On' Click‘,' A‘,functionE) {E.Preventdefault ();E.Stoppropagation ();Framework.redirect$(This).attrframework. redirect ( '/homepage/framework. on ( ' Location ", function (url) {var menu = $ ( "Menumenu. find ( "Selected").  Removeclass ( ' selected '); Menu.find (' a[href= ' + URL + '] '). Parent (). AddClass (' selected ');              

Partial.js Client-side Routing (client-side routing-History API based on HTML5 Spa features)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.