网页右下角有广告图片,通过点击进行切换
2013-04-28 10:46
190 查看
1、在页面中添加两个div:
<div class="right_bottom01"><a href="#"></a></div>
<div class="right_bottom02"><a href="#"></a></div>
2、在样式中进行设置:(图片路径要注意)
<style type="text/css">
.right_bottom01 { width:95px; height:170px; display:block; position:fixed; right:10px; bottom:100px; background:url(../images/01.png) no-repeat;_position: absolute;
right: 10px;
bottom: 100px;
_bottom: "auto";
cursor: pointer;}
.right_bottom02 { width:140px; height:238px; display:none; position:fixed; right:1px; bottom:100px; background:url(../images/02.png) no-repeat;_position: absolute;
right: 10px;
bottom: 100px;
_bottom: "auto";
cursor: pointer;}
</style>
3、通过js代码进行切换
<script type="text/javascript">
$(function()
{
$(".right_bottom01").bind("click",function(){wxSwitch(1);});
$(".right_bottom02").bind("click",function(){wxSwitch(2);});
}
//切换方法
function wxSwitch(f)
{
if(f==1)
{
$(".right_bottom01").hide();
$(".right_bottom02").show();
}
else
{
$(".right_bottom01").show();
$(".right_bottom02").hide();
}
}
</script>
<div class="right_bottom01"><a href="#"></a></div>
<div class="right_bottom02"><a href="#"></a></div>
2、在样式中进行设置:(图片路径要注意)
<style type="text/css">
.right_bottom01 { width:95px; height:170px; display:block; position:fixed; right:10px; bottom:100px; background:url(../images/01.png) no-repeat;_position: absolute;
right: 10px;
bottom: 100px;
_bottom: "auto";
cursor: pointer;}
.right_bottom02 { width:140px; height:238px; display:none; position:fixed; right:1px; bottom:100px; background:url(../images/02.png) no-repeat;_position: absolute;
right: 10px;
bottom: 100px;
_bottom: "auto";
cursor: pointer;}
</style>
3、通过js代码进行切换
<script type="text/javascript">
$(function()
{
$(".right_bottom01").bind("click",function(){wxSwitch(1);});
$(".right_bottom02").bind("click",function(){wxSwitch(2);});
}
//切换方法
function wxSwitch(f)
{
if(f==1)
{
$(".right_bottom01").hide();
$(".right_bottom02").show();
}
else
{
$(".right_bottom01").show();
$(".right_bottom02").hide();
}
}
</script>
相关文章推荐
- 通过CSS切换图片效果,点击这个图片可以实现连接功能,这里的图片在一张大图片中,每个并要切换的图片没有切换,通过disposition定位的方式做
- 进击的KFC:iOS WebView 如何通过js获取网页中所有图片并加入点击事件,实现浏览图片的功能
- 用JQ中的fadeOut和fadeIn方法,当点击上一张和下一张按钮时进行图片的切换~
- Axure教程:广告图片自动轮播+点击切换
- JavaScript实现简单的图片轮播(通过点击左右焦点切换)
- JavaScript实现简单的图片轮播(通过点击数字切换)
- IE6下通过a标签点击切换图片的问题
- 自动循环切换图片的ViewPager,类似网页的广告页面切换
- 广告banner:手动滑动切换,自动切换,点击跳转,异步加载网络图片
- 通过js写的一个比较简单的点击切换图片效果
- iOS WebView 如何通过js获取网页中所有图片并加入点击事件,实现浏览图片的功能
- 广告banner:手动滑动切换,自动切换,点击跳转,异步加载网络图片
- IE6下通过a标签点击切换图片的问题
- ReclyView点击图片进行切换
- android 点击底部图片进行切换不同的Fragment
- 切换点击的图片(一组图片),2张进行切换
- 用JQ中的fadeOut和fadeIn方法,当点击上一张和下一张按钮时进行图片的切换~
- PS怎样不通过图层面板,而通过鼠标点击图片直接切换图层
- js简单的通过点击“上一张”“下一张”图片切换
- 点击某个按钮切换图片(按钮颜色跟着改变)