html页面添加左侧滑动菜单与内容部分的滚动条
html + css + jquery
展示地址:https://migloo.gitee.io/front 或 https://www.igloo.xin/front
思路:
1、通过jquery的animate方法,实现menu菜单的滑出滑入
2、menu菜单通过relative的设置,将其默认设置到页面左侧不可视区
3、通过点击事件,调用animate,将menu滑出滑入
样式如下:
指定一个固定大小的区域显示的样式如下:
代码如下:
body {
width: 100vw;
height: 100vh;
padding: 0;
margin: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
background: #FFEBCD;
} body>div {
width: 360px;
height: 640px;
border: 3px groove blanchedalmond;
border-radius: 8px;
background: #f1f1f1;
padding: 5px;
overflow: hidden;
} .page {
width: 500px;
height: 100%;
display: flex;
flex-direction: row;
position: relative;
left: -140px;
} .content {
height: 100%;
width: 360px;
display: flex;
flex-direction: column;
} .content>img {
margin-top: 15px;
margin-left: 10px;
cursor: pointer;
height: 26px;
width: 32px;
} .content>div {
flex-grow: 1;
overflow: auto;
padding: 5px;
font-size: 2em;
-webkit-overflow-scrolling: touch;
} .menu {
height: 100%;
width: 120px;
margin-right: 20px;
display: flex;
flex-direction: column;
} .menu>div {
margin: 5px 0 10px 5px;
}
设置自动适应全部网页空间的样子如下:
<style type="text/css">
body {
padding: 0;
margin: 0;
width: 100vw;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
} .page {
width: 100%;
height: 100%;
overflow: hidden;
} .container {
position: relative;
left: -200px;
width: calc(100% + 200px);
height: 100%;
display: flex;
flex-direction: row;
} .menu {
width: 200px;
height: 100%;
background: linear-gradient(white, black);
} .scroll {
flex-grow:1;
height: 100%;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
.content {
width: 100%;
height: 300%;
background: linear-gradient(black, white);
}
</style>
html页面添加左侧滑动菜单与内容部分的滚动条的更多相关文章
- SlidingMenu 左侧滑动菜单
1.MainActivity package loveworld.slidingmenu; import java.util.ArrayList; import android.app.Activit ...
- jquery插件:点击拉出的右侧滑动菜单
就是一个停留在页面右侧的滑动菜单,点击可以拉出,带回调函数.宽高位置可以参数指定.插件代码如下: (jquery的路径请自己修改) (function($){ $.fn.sideSwitch = fu ...
- 如何在C#添加鼠标右键菜单
C#添加鼠标右键方法步骤: 1 选中要添加右键功能的Form或者控件,打开控件的设计页面. 2 从工具箱中找到ContextMenuStrip控件,将这个控件拖曳到Form或者控件的设计页面上.这时系 ...
- C# WPF 左侧菜单右侧内容布局效果实现
原文:C# WPF 左侧菜单右侧内容布局效果实现 我们要做的效果是这样的,左侧是可折叠的菜单栏,右侧是内容区域,点击左侧的菜单项右侧内容区域则相应地切换. wpf实现的话,我的办法是用一个tabcon ...
- angularjs中向html页面添加内容节点元素代码段的两种方法
第一种方式:原生JS向html页面添加内容节点元素代码段: <!DOCTYPE html> <html> <head> <meta charset=" ...
- 原生H5页面模拟APP左侧滑动删除效果
话不多说,往左侧滑动,显示删除,我们先来看一下效果图:如下: 这个布局我就不多说,反正就是一行ul,li, class名“item” js代码如下: $(".item").on(& ...
- Android 学习笔记之AndBase框架学习(七) SlidingMenu滑动菜单的实现
PS:努力的往前飞..再累也无所谓.. 学习内容: 1.使用SlidingMenu实现滑动菜单.. SlidingMenu滑动菜单..滑动菜单在绝大多数app中也是存在的..非常的实用..Gith ...
- Android滑动菜单框架完全解析,教你如何一分钟实现滑动菜单特效
转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/8744400 之前我向大家介绍了史上最简单的滑动菜单的实现方式,相信大家都还记得.如 ...
- [转]玩转Angular2(4)--制作左侧自动定位菜单
本文转自:https://godbasin.github.io/2017/06/02/angular2-free-4-create-sidebar/ 因为项目原因又玩上了Angular2(v4.0+) ...
随机推荐
- Java学习之初识Maven
简介 功能特点 Maven主要作用类似于VS的包管理器,能够帮助开发者完成以下工作:构建.文档生成.报告.依赖.SCMs.发布.分发.邮件列表等. 详细请阅读:https://www.runoob.c ...
- [转]全面认识golang string
作者:@apocelipes本文为作者原创,转载请注明出处:https://www.cnblogs.com/apocelipes/p/9798413.html string我们每天都在使用,可是对于s ...
- MySQL 分库分表及其平滑扩容方案
转自:https://kefeng.wang/2018/07/22/mysql-sharding/ 众所周知,数据库很容易成为应用系统的瓶颈.单机数据库的资源和处理能力有限,在高并发的分布式系统中,可 ...
- 浅谈Vue.js2.0核心思想
Vue.js是一个提供MVVM数据双向绑定的库,专注于UI层面,核心思想是:数据驱动.组件系统. 数据驱动: Vue.js数据观测原理在技术实现上,利用的是ES5Object.defineProper ...
- make CMake 来龙去脉
理论上说,任意一个C++程序都可以用g++来编译. 大家都知道,写程序大体步骤如下: 1.用编辑器编写源代码,如.c文件. 2.用编译器编译代码生成目标文件,如.o. 3.用链接器连接目标代码生成可执 ...
- 【转载】Gradle学习 第八章:依赖管理基础
转载地址:http://ask.android-studio.org/?/article/10 This chapter introduces some of the basics of depend ...
- How to prove that SAP CRM WebUI is a stateful application
I create an enhancement in this function module to print out current session id: As long as I do not ...
- 在ubuntu更新时,出现错误E: Some index files failed to download, they have been ignored, or old ones used inst
原文:https://blog.csdn.net/tian_ciomp/article/details/51339635 在ubuntu更新时,出现错误E: Some index files fail ...
- MySQL数据物理备份之lvm快照
使用lvm快照实现物理备份 优点: 几乎是热备(创建快照前把表上锁,创建完后立即释放) 支持所有存储引擎 备份速度快 无需使用昂贵的商业软件(它是操作系统级别的) 缺点: 可能需要跨部门协调(使用操作 ...
- 配置管理-git研究(版本管理)
1. 安装git2.7 git2.7具体安装步骤如下: [root@host1 ~]# yum install curl-devel expat-devel gettext-devel openssl ...