html图片显示当前位置,css – 如何根据当前视口位置将图像置于特定div中?

这段代码展示了如何使用JavaScript实现页面元素的点击事件以及加载动画。当点击特定按钮时,元素会左右隐藏,同时触发加载动画。点击过滤按钮会更新内容,并显示加载指示器。涉及到的技术包括CSS3动画、JavaScript事件监听和DOM操作。
摘要由CSDN通过智能技术生成

这对我来说效果最好:)

function loadNewContent(){

$(".loaderCont").removeClass("loading")

}

$(document).ready(function () {

$("#hide_button").on("click",function () {

$(this).closest(".bottom").toggleClass("left_hided");

$(".loaderCont").toggleClass("left_hided2");

});

$("#filter1,#filter2,#filter3,#filter4").on("click",function() {

$(".loaderCont").addClass("loading");

setTimeout(loadNewContent,2000);

});

});

CSS:

.header {

background-color: Green;

width: 100%;

margin-bottom: 20px;

height: 100px;

}

.left {

background-color: Red;

float: left;

width: 100px;

}

.left_hided .left{

margin-left: -85px;

}

.right {

background: Aqua url("http://i.imgur.com/ifyW4z8.png") 50% repeat-y;

width: calc(100% - 140px);

float: right;

}

.left_hided .right{

width: calc(100% - 55px);

}

input{

float:right;

}

.loaderCont {

background-color: rgba(255,0.6);

height: 100%;

width: calc(100% - 140px);

position: fixed;

right: 0;

top: 0;

z-index: -1;

}

.left_hided2 {

width: calc(100% - 55px);

}

#loader {

background: url(http://i.stack.imgur.com/FhHRx.gif) no-repeat center center;

position: relative;

top: calc(50% - 16px);

left: calc(50% - 16px);

display: block;

height: 32px;

width: 32px;

}

.loading {

z-index: 9001;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值