网页仿手机右侧推出推入div块
2016-01-07 18:32
190 查看
目的:优化原界面N多model的情况,改为右侧push出div块,姿势要求华丽炫目夺眼球
代码块样式:
<div id="push" style="background-color:#ff;display:none;
Position:absolute;z-index:1000;">
这是将要从右侧推出的华丽炫目夺眼球的代码块
</div>
加载时初始化
推出推入方法
//pushout方法
function f_closepush(){
var winwidth = jQuery(window).width();
jQuery("#push").css('width',winwidth*0.4+"px");
jQuery("#push").hide().animate({right:"-"+winwidth*0.4+"px"});
}
//pushin方法
function f_openpush(){
var winwidth = jQuery(window).width();
jQuery("#push").css('right',"-"+winwidth*0.4+"px");
jQuery("#push").show().animate({right:"0px"});
}
代码块样式:
<div id="push" style="background-color:#ff;display:none;
Position:absolute;z-index:1000;">
这是将要从右侧推出的华丽炫目夺眼球的代码块
</div>
加载时初始化
f_init(){ //获取浏览器的高度和宽度 Var winheight = jQuery(window).height(); Var winwidth = jQuery(window).width(); //设置高度 jQuery("#push").css('height',winheight+"px"); //设置宽度设为浏览器的40% jQuery("#push").css("width",winwidth*0.4+"px"); }
推出推入方法
//pushout方法
function f_closepush(){
var winwidth = jQuery(window).width();
jQuery("#push").css('width',winwidth*0.4+"px");
jQuery("#push").hide().animate({right:"-"+winwidth*0.4+"px"});
}
//pushin方法
function f_openpush(){
var winwidth = jQuery(window).width();
jQuery("#push").css('right',"-"+winwidth*0.4+"px");
jQuery("#push").show().animate({right:"0px"});
}
相关文章推荐
- python入门(三)
- 设计模式之工厂模式
- Apache以及PHP的默认编码问题解决(详解)
- vijos P1243 生产产品(单调队列+DP)
- svg 颜色
- Composite——设计模式学习笔记
- 解决reportNG中文乱码
- C# Seal用法
- 泛型算法 与 操作符重载
- svg 笔画和填充
- matlab图像处理 Introduction to MATLAB
- 三维数组A和一个简单c问题
- SQL 格式化 数字 (前面加0)情况
- 65条最常用正则表达式
- IntelliJ IDEA :Error:(1, 1) java: 非法字符: '\ufeff'
- eclipse cannot resolved to a type 多种解决方案
- 分享C++/C如何开机自动启动代码和c的改错题
- svg 文本图像
- [转]验证E-mail、用户名、社保号、IP地址等10个实用的PHP正则表达式
- 安装 openSUSE 13.1 后必须做的10件事情