100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > JQuery实现侧边栏菜单

JQuery实现侧边栏菜单

时间:2020-09-30 09:30:24

相关推荐

JQuery实现侧边栏菜单

web前端|js教程

JQuery,菜单,实现

web前端-js教程效果图如下:

网页游戏开服表程序源码,ubuntu下载软件地址,爬虫做什么好,Php点阵,无名网seolzw

自动抽奖系统源码,vscode创建自己的模板,ubuntu 开机 检测,怎么清理tomcat日志,python 爬虫技巧,记事本写php,辽宁有实力的seo服务,解析接口网站源码,团购网站单页模板lzw

在线预览 源码下载

申诉网站源码,vscode各种插件,ubuntu wamp,阿里tomcat面试,sqlite写入验证信息,js 压缩插件,移动端app的前端框架,解析网页结构实现爬虫,php的prepare,武汉seo的优化,手机挖矿分红网站源码,艺术网页模版,帝国cms模板安装教程lzw

html代码:

点击左上角的按钮打开菜单

适用浏览器:、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗.

不支持IE及以下浏览器。

js代码:

var paperMenu = { $window: $(#paper-window), $paperFront: $(#paper-front), $hamburger: $(.hamburger), offset: , pageHeight: $(#paper-front).outerHeight(), open: function () { this.$window.addClass( ilt); this.$hamburger.off(click); $(#container, .hamburger).on(click, this.close.bind(this)); this.hamburgerFix(true); // console.log(opening...); }, close: function () { this.$window.removeClass( ilt); $(#container, .hamburger).off(click); this.$hamburger.on(click, this.open.bind(this)); this.hamburgerFix(false); // console.log(closing...); }, updateTransformOrigin: function () { scrollTop = this.$window.scrollTop(); equation = (scrollTop + this.offset) / this.pageHeight * ; this.$paperFront.css( ransform-origin, center + equation + \%); }, hamburgerFix: function (opening) { if (opening) {$(.hamburger).css({position: absolute,top: this.$window.scrollTop() + + px}); } else {setTimeout(function () {$(.hamburger).css({ position: fixed, top: px});}, ); } }, bindEvents: function () { this.$hamburger.on(click, this.open.bind(this)); $(.close).on(click, this.close.bind(this)); this.$window.on(scroll, this.updateTransformOrigin.bind(this)); }, init: function () { this.bindEvents(); this.updateTransformOrigin(); } }; paperMenu.init();

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。