Web前端 遮罩的应用-等级评定

实现非完整颗星的评价效果

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<style>
.stars {
    display: inline-block;
    color: #FDB338;
}
.text-icon {
    font-family: base_icon;
    display: inline-block;
    vertical-align: middle;
    font-style: normal;
}
.text-icon.icon-star:after {
    content: "★";
}
.text-icon.icon-star-gray {
    position: relative;
}

.text-icon.icon-star-gray<span style="color:#ff0000;">:after</span> {
	color: #E2E2E2;
	content:"★";
}

.text-icon.icon-star-half {
	position: absolute;
    left: 0px;
	<strong><span style="color:#ff0000;">width:0.1em;</span></strong>
    <span style="color:#ff0000;"><strong>overflow: hidden;</strong></span>
}
.text-icon.icon-star-half<strong><span style="color:#ff0000;">:after</span></strong>{

	content:"★";

}
</style>
</head>

<body>
<span class='stars'>
<i class="text-icon icon-star"></i>
<i class="text-icon icon-star"></i>
<i class="text-icon icon-star"></i>
<i class="text-icon icon-star"></i>
<i class="text-icon icon-star"></i>
<i class="text-icon icon-star-gray">
	<i class="text-icon icon-star-half" style="width:0.50em">
    </i>
</i>
</span>
</body>
</html>


//1層遮罩整個IFrame function hideIframe1() { hideIframe(0); } //2層遮罩整個IFrame function hideIframe2() { hideIframe(1); } //3層遮罩整個IFrame function hideIframe3() { hideIframe(2); } //遮罩整個IFrame function hideIframe(level) { var div = document.createElement("div"); var iframe=document.createElement("iframe"); var img=document.createElement("img"); div.id = "InnerDiv"; div.style.width=document.documentElement.scrollWidth +"px" div.style.height=document.documentElement.scrollHeight +"px" div.style.margin="0px"; div.style.padding="0px"; div.style.zIndex="19999"; div.style.position="absolute"; div.style.backgroundColor="black"; div.style.left="0px"; div.style.top="0px"; div.style.filter="alpha(opacity=80)"; div.style.opacity="0.8"; iframe.id = "LoadingIframe"; iframe.style.width="100%"; iframe.style.height="100%"; iframe.style.backgroundColor="black"; img.id = "LoadingImg"; img.style.width="219px"; img.style.height="66px"; img.style.marginTop="-33px"; img.style.marginLeft="-109.5px"; img.style.padding="0px"; img.style.zIndex="20000"; img.style.position="absolute"; img.style.left="50%"; img.style.top="50%"; var path = ""; for(var i=0;i<level;i++) { path += "../"; } img.src=path+"Images/Loading.gif"; div.appendChild(iframe); document.body.appendChild(div); document.body.appendChild(img); } //隱藏整個IFrame function showIframe() { if(document.getElementById("InnerDiv")!=null) { document.body.removeChild(document.getElementById("InnerDiv")); } if(document.getElementById("LoadingImg")!=null) { document.body.removeChild(document.getElementById("LoadingImg")); } } //遮罩整個IFrame function hideIframeNoImg(level) { var div = document.createElement("div"); var iframe=document.createElement("iframe"); div.id = "InnerDiv"; div.style.width=document.documentElement.scrollWidth +"px" div.style.height=document.documentElement.scrollHeight +"px" div.style.margin="0px"; div.style.padding="0px"; div.style.zIndex="19999"; div.style.position="absolute"; div.style.backgroundColor="black"; div.style.left="0px"; div.style.top="0px"; div.style.filter="alpha(opacity=80)"; div.style.opacity="0.8"; iframe.id = "LoadingIframe"; iframe.style.width="100%"; iframe.style.height="100%"; iframe.style.backgroundColor="black"; div.appendChild(iframe); document.body.appendChild(div); } //隱藏整個IFrame function showIframeNoImg() { if(document.getElementById("InnerDiv")!=null) { document.body.removeChild(document.getElementById("InnerDiv")); } }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值