Code Monkey home page Code Monkey logo

pjax's Introduction

slidePjax

pjax with slide animation, fade/slide, you can also custom your own animation degrade to ie8 with hash, ie8 alse can animate thanks velocityjs for perfect animation

依赖

jquery.js
velocity.js

使用方法

// html结构
<div class="container-selector">
	<div class="contentNew-selector"></div>
	<div class="contentInner-selector"></div>
</div>

// pjax初始化
$.pjax({
    container: '.swiper-container',  // 组件初始化的container-selector
    selector: 'a[data-ajax="true"]',  // 触发异步请求的selector,一般是a标签
    contentNew: '.swiper-container .content-new', // 新加载的内容容器
    contentInner: '.swiper-container .content-inner', // 原始内容容器,新内容加载完成后,即变成了原始内容
    pagePriority: { 
    	// 由于slide需要确定左右方向,所以根据pagePriority参数来判断
    	// 如果page优先级一样,默认使用fade切换
    	// 如果page优先级一样,且page都一样,不做任何切换
        '/': 1,
        '/page1.html': 1,
        '/page1-1.html': 1,

        '/page2.html': 2,
        '/page2-2.html': 2,

        '/page3.html': 3,
        '/page3-2.html': 3
    },
    show: 'slide', // 页面替换动画类型,可以自定义
    cache: false, // 是否使用缓存
    storage: false, // 是否使用本地存储,谨慎使用,除非本地app
    titleSuffix: '', // 标题后缀
    filter: function() {}, // 过来selector,用来构建更复杂的长青
    callback: function() {} // 回调函数
})

pjax's People

Contributors

qixiuss avatar

Stargazers

luoage avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.