第一百四十六节,JavaScript,百度分享保持居中--下拉菜单
JavaScript,百度分享保持居中--下拉菜单
百度分享保持居中
效果图

html代码
<div id="share">
<h2>分享到</h2>
<ul>
<li><a href="###" class="a">一键分享</a></li>
<li><a href="###" class="b">新浪微博</a></li>
<li><a href="###" class="c">人人网</a></li>
<li><a href="###" class="d">百度相册</a></li>
<li><a href="###" class="e">腾讯朋友</a></li>
<li><a href="###" class="f">豆瓣网</a></li>
<li><a href="###" class="g">百度首页</a></li>
<li><a href="###" class="h">和讯微博</a></li>
<li><a href="###" class="i">QQ 空间</a></li>
<li><a href="###" class="j">百度搜藏</a></li>
<li><a href="###" class="k">腾讯微博</a></li>
<li><a href="###" class="l">开心网</a></li>
<li><a href="###" class="m">百度贴吧</a></li>
<li><a href="###" class="n">搜狐微博</a></li>
<li><a href="###" class="o">QQ 好友</a></li>
<li><a href="###" class="p">更多...</a></li>
</ul>
<div class="share_footer"><a href="###">百度分享</a><span></span></div>
</div>
css代码
/*百度分享*/
#share {
width:210px;
height:315px;
border:1px solid #ccc;
position:absolute;
top:;
left:-211px;
background:#fff;
}
#share h2 {
height:30px;
line-height:30px;
background:#eee;
padding:;
margin:;
font-size:14px;
color:#666;
text-indent:10px;
}
#share ul {
height:254px;
padding:3px 0 2px 5px;
}
#share ul li {
width:96px;
height:28px;
float:left;
padding:2px;
}
#share ul li a {
display:block;
width:95px;
height:26px;
line-height:26px;
text-decoration:none;
color:#666;
background-image:url('img/share_bg.png');
background-repeat:no-repeat;
text-indent:30px;
}
#share ul li a.a {
background-position:5px 4px;
}
#share ul li a.b {
background-position:5px -26px;
}
#share ul li a.c {
background-position:5px -56px;
}
#share ul li a.d {
background-position:5px -86px;
}
#share ul li a.e {
background-position:5px -116px;
}
#share ul li a.f {
background-position:5px -146px;
}
#share ul li a.g {
background-position:5px -176px;
}
#share ul li a.h {
background-position:5px -206px;
}
#share ul li a.i {
background-position:5px -236px;
}
#share ul li a.j {
background-position:5px -266px;
}
#share ul li a.k {
background-position:5px -296px;
}
#share ul li a.l {
background-position:5px -326px;
}
#share ul li a.n {
background-position:5px -356px;
}
#share ul li a.m {
background-position:5px -386px;
}
#share ul li a.o {
background-position:5px -416px;
}
#share ul li a.p {
background-position:5px -446px;
}
#share ul li a:hover {
opacity:0.7;
filter:alpha(opacity=70);
background-color:#eee;
color:#06f;
}
#share .share_footer {
height:26px;
background:#eee;
position:relative;
}
#share .share_footer a {
position:absolute;
top:7px;
left:140px;
padding:0 0 0 13px;
background:#eee url('img/share_bg.png') no-repeat 0 -477px;
text-decoration:none;
color:#666;
}
#share .share_footer a:hover {
color:#06f;
opacity:0.7;
filter:alpha(opacity=70);
}
#share .share_footer span {
display:block;
width:24px;
height:88px;
position:absolute;
top:-178px;
left:210px;
background:url('img/share.png') no-repeat;
cursor:pointer;
}
前台js代码
// 百度分享
//获取百度分享区块让它垂直居中,滚动条头部位置加浏览器窗口高度,减去百度分享高度除以2,等于居中位置
$('#share').c_css('top',gun_dong_tiao_wei_zhi().top + (getInner().height - yuan_su_da_xiao($('#share').jie_dian[0]).height) / 2 + 'px'); addEvent(window,'scroll',function () { //滚动条事件,当拖动滚动条时执行居中
$('#share').yi_dong_tou_ming({
'attr': 'y', //动画方式
'target': gun_dong_tiao_wei_zhi().top + (getInner().height - yuan_su_da_xiao($('#share').jie_dian[0]).height) / 2, //目标量
't': 50, //每次动画时间
'step':20 //跨度
});
}); $('#share').chuang_kou_shi_jian(function () { //窗口变化事件,当拖窗口变化时执行居中
$('#share').yi_dong_tou_ming({
'attr': 'y', //动画方式
'target': gun_dong_tiao_wei_zhi().top + (getInner().height - yuan_su_da_xiao($('#share').jie_dian[0]).height) / 2, //目标量
't': 50, //每次动画时间
'step':20 //跨度
});
});
$('#share').shu_biao_yi_ru_yi_chu(function () { //鼠标移入移出事件
$(this).yi_dong_tou_ming({
'attr': 'x', //动画方式
'target': 0 //目标量
});
},function () {
$(this).yi_dong_tou_ming({
'attr': 'x', //动画方式
'target': -211 //目标量
});
});
下拉菜单
效果图

html
<div class="ge_ren_zhong_xin">个人中心
<ul class="xg">
<li><a href="#">设置</a></li>
<li><a href="#">换肤</a></li>
<li><a href="#">帮助</a></li>
<li><a href="#">退出</a></li>
</ul>
</div>
css
.ge_ren_zhong_xin{
position: relative;
width: 70px;
height: 30px;
line-height: 30px;
float: right;
background: url("img/arrow.png") no-repeat right center;
cursor: pointer;
}
.ge_ren_zhong_xin ul{
width: 100px;
height:;
position: absolute;
top:30px;
right: -15px;
background:#FBF7E1;
border:1px solid #999;
border-top:none;
padding:10px 0 0 0;
filter:alpha(opacity=0);
opacity:;
display:none;
overflow:hidden;
}
.ge_ren_zhong_xin ul li {
height:25px;
line-height:25px;
text-indent:20px;
letter-spacing:1px;
}
.ge_ren_zhong_xin ul li a {
display:block;
text-decoration:none;
color:#333;
background:url("img/arrow3.gif") no-repeat 5px 45%;
}
.ge_ren_zhong_xin ul li a:hover {
background:#fc0 url("img/arrow4.gif") no-repeat 5px 45%;
}
前台js
// 个人中心
$('#tou .ge_ren_zhong_xin').shu_biao_yi_ru_yi_chu(function () {
$(this).c_css('background','url("img/arrow2.png") no-repeat right center');
$('#tou .xg').xian_shi().yi_dong_tou_ming({
't': 50, //每次动画时间
'step': 20, //跨度
mul:{
'h':110,
'o':100
}
});
},function () {
$(this).c_css('background','url("img/arrow.png") no-repeat right center');
$('#tou .xg').xian_shi().yi_dong_tou_ming({
't': 50, //每次动画时间
'step': 20, //跨度
mul:{
'h':0,
'o':0
},
fn:function () {
$('#tou .xg').yin_cang();
}
});
});
先必须引入函数库和封装库
第一百四十六节,JavaScript,百度分享保持居中--下拉菜单的更多相关文章
- 第三百四十六节,Python分布式爬虫打造搜索引擎Scrapy精讲—Requests请求和Response响应介绍
第三百四十六节,Python分布式爬虫打造搜索引擎Scrapy精讲—Requests请求和Response响应介绍 Requests请求 Requests请求就是我们在爬虫文件写的Requests() ...
- Bootstrap入门(十)组件4:按钮组与下拉菜单结合
Bootstrap入门(十)组件4:按钮组与下拉菜单结合 先引入本地的CSS文件和JS文件(注:1.bootstrap是需要jQuery支持的.2.需要在<body>当中添加) < ...
- 第一百四十三节,JavaScript,利用封装库做百度分享
JavaScript,利用封装库做百度分享 效果图 html代码 <div id="share"> <h2>分享到</h2> <ul> ...
- 第一百四十四节,JavaScript,列队动画
JavaScript,列队动画 将上一节的,移动透明动画,修改成可以支持列队,也就是可以给这个动画方法多个动画任务,让它完成一个动画任务后,在执行第二个动画任务 原理: 就是在原有的动画方法里加一个回 ...
- 第一百一十六节,JavaScript,DOM操作样式
JavaScript,DOM操作样式 一.操作样式 CSS作为(X)HTML的辅助,可以增强页面的显示效果.但不是每个浏览器都能支持最新的CSS能力.CSS的能力和DOM级别密切相关,所以我们有必要检 ...
- 第一百四十五节,JavaScript,同步动画
JavaScript,同步动画 将上一节的,移动透明动画,修改成可以支持同步动画,也就是可以给这个动画方法多个动画任务,让它同时完成 原理: 向方法里添加一个属性,这个属性是一个对象,同步动画属性,属 ...
- 第一百四十九节,封装库--JavaScript,表单验证--验证用户名
封装库--JavaScript,表单验证--验证用户名 注册验证功能,顾名思义就是验证表单中每个字段的合法性,如果全部合法才可以提交表单. 效果图 聚集光标时 信息不合法是 信息合法时 html &l ...
- 第二百四十六节,Bootstrap弹出框和警告框插件
Bootstrap弹出框和警告框插件 学习要点: 1.弹出框 2.警告框 本节课我们主要学习一下 Bootstrap 中的弹出框和警告框插件. 一.弹出框 弹出框即点击一个元素弹出一个包含标题和内容的 ...
- leecode第一百四十六题(LRU缓存机制)
class LRUCache { private: unordered_map<int, list<pair<int,int>>::iterator> _m; // ...
随机推荐
- easyui中combotree只能选子选项,父级不被选中
前言 前几天面试遇到一个需求(easyui中combotree只能选子选项,父级不被选中),回来特意整理下,大概的思想是如果该tree的节点被选中是判定一下是否有子节点,如果没有就说明是最终节点了,步 ...
- weblogic 异常 com.rsa.jsafe.JSAFE_PaddingException: Could not perform unpadding: invalid pad byte.次异常怎么解决
问题 更改控制台密码后,服务重启失败,无法启动,报错如下: <-- 下午03时10分49秒 CST> <Info> <WebLogicServer> <BEA ...
- css颜色大全
本文来自:http://www.cnblogs.com/axing/archive/2011/04/09/CSS.html CSS颜色代码大全: FFFFFF #DDDDDD #AAAAAA #888 ...
- 关于bitmap recycle trying to use a recycled bitmap android.graphics.Bitmap
在开发中,一直使用4.0以上手机作为測试机所以一直没有出现这个问题,今天换了2.3版本号的手机.出现了这个错误: trying to use a recycled bitmap android.gra ...
- 使用caffe的HDF5数据完毕回归任务
一直在研究怎样用caffe做行人检測问题.然而參考那些经典结构比方faster-rcnn等,都是自己定义的caffe层来完毕的检測任务. 这些都要求对caffe框架有一定程度的了解.近期看到了怎样用c ...
- python冒泡算法
array = [1,2,3,6,5,4,28,2,1,9,3,0,200,2,9,3,2,98,33,988,22,0,223,0,33,78,222,88,32,0,238,883,2,0,23] ...
- STL源码剖析(迭代器)
在STL中,容器跟算法是分开设计的,算法是通过迭代器来对容器进行操作的. 在算法运用迭代器的时候,可能会用到其相应的型别,例如返回值为容器中元素的型别,又或者说根据迭代器的类型来选择更好的算法等等. ...
- 【Linux】替换文本中的字符
替换单个文本中的字符,有两种方法,如下详解 VIM替换 打开文件 vim test.txt 替换 :%s/原字符串/替换字符串/gg 直接替换 sed -i 's/原字符串/替换字符串/g' `ls ...
- 记一则Linux病毒的处理
今天某项目经理反馈学校的某台服务器不停的向外发包,且CPU持续100%,远程登录后查看发现有一长度为10的随机字符串进程,kill掉,会重新生成另外长度为10的字符串进程.删除文件也会重复生成,非常痛 ...
- DevExpress SpinEdit控件使用实例——删除ASPxSpinEdit右边的上下小箭头SpinButtons-ShowIncrementButtons
使用ASPxSpinEdit来添加数字类型的输入框: 默认情况下, SpinEdit通过点击右边的上下箭头来加减number,下面的代码是去掉上下箭头,内容居中显示,并将边框颜色置为白色: <d ...