@dinoreic/pjax
Pjax - faster loading of HTML pages
Last updated a year ago by dinoreic .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @dinoreic/pjax 
SYNC missed versions from official npm registry.

Pjax - faster HTML pages loading

How to use?

Pjax will replace only contents of MAIN HTML tag https://www.w3schools.com/tags/tag_main.asp

Simple manual usage

Load page using Pjax

import '@dinoreic/pjax'

// regular page load
Pjax.load('/about')

// load page with no scroll and cache-control='no-cache'
Pjax.load('/about', { no_cache: true, no_scroll: true })

You will need to register document.on('click') handler to use Pjax.

Skip pjax on followin links and do location.href = target

Pjax.skip('/admin', '/login')

if you want to automaticly reload headers and a page on a different template, use unique template id meta tag

<meta name="pjax_template_id" content="foobar" />

No autoscrool to the top of the page

If target element (href link) or one of its paretns has defined one of the skiping classes, page window.scrollY will be kept.

Pjax.keep_scrool('.no-scroll', '.menu-heading', '.skill')

Execute action before pjax load and do not proceed if return is false

Pjax.before (href, opts) ->
  if opts.node
    if opts.node.closest('.in-popup')
      Dialog.load href
      return false
  true

Init Pjax, + optionaly send function to execute on every page request

Pjax.init ->
  Widget.bind()
  Dialog.close()
  ga('send', 'pageview') if window.ga;

Current Tags

  • 0.2.4                                ...           latest (a year ago)

5 Versions

  • 0.2.4                                ...           a year ago
  • 0.2.3                                ...           a year ago
  • 0.2.2                                ...           a year ago
  • 0.2.1                                ...           a year ago
  • 0.2.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |