首页 > 其他 > 详细

浏览器历史,判断是点击了后退按钮还是前进按钮

时间:2016-03-03 06:50:14      阅读:521      评论:0      收藏:0      [点我收藏+]
var history = this.state.history,
            pages = this.state.pages,
            l = history.length,
            hash = window.location.hash,
            position = "center";

        if (l === 0) {
            history.push(hash);
        } else if (hash === history[l - 2]) {
            history.pop();
            position = "left";
        } else {
            history.push(hash);
            position = "right";
        }

https://github.com/zyip/react/blob/master/src/main.js

 

浏览器历史,判断是点击了后退按钮还是前进按钮

原文:http://www.cnblogs.com/zyip/p/5237144.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!