zoukankan      html  css  js  c++  java
  • 单页面跳转添加返回和跳转动画(仿app) 只对单页面和跳转有用,我用的是angualr,有不会的可以私信问我。

    var pageManager = {

    _pageIndex: 1,

    init:function() {

    var self = this;

    $scope.$on('$locationChangeStart', function() {

    var state = history.state || {};

    console.log(state._pageIndex)

    console.log(self._pageIndex)

    if(state._pageIndex <= self._pageIndex) {

    console.log('返回')

        //添加动画样式

      self._back();

    } else {

    console.log('跳转')

        //添加动画样式

    self._go();

    }

    if(history.state) {

    this._pageIndex = history.state._pageIndex;

    }

    this._pageIndex--;

    return this;

    });

    },

            _go: function (config) {

                this._pageIndex ++;

                history.replaceState && history.replaceState({_pageIndex: this._pageIndex}, '', location.href);

                return this;

            },

            _back: function (config) {

                this._pageIndex --;

                return this;

            },

    }

        .init();

  • 相关阅读:
    codeAnalyze_函数赋值给另一个函数的形参
    js_new关键字创建对象的五个步骤
    codeRecord_bind
    js_活动对象与变量对象的区别
    将linux的随机ip固定为设置的固定ip
    Springcloud总结
    Jackson的使用
    Lucene的初步了解和学习
    Shiro安全框架
    关于xpath中的tbody
  • 原文地址:https://www.cnblogs.com/zyzhao/p/7479792.html
Copyright © 2011-2022 走看看