1.我在<div caltag="b_onmouse"> 新增了一个属性.
2.通过这个属性$(document).ready(function(){
$("[caltag='b_onmouse']").hover(function(){
$(this).css("opacity","0.8");
$(this).css("cursor","pointer");
$(this).attr("bg",bgb).css("background-color","#FFFF93");
},function(){
$(this).css("background",bgb).removeAttr("bg");
});
})//hover的时候改变它的背景色现在问题来了
我想要的层是一个呈现在DIV上面的层.怎么办?下面是写的测试代码.bgb = ($("[caltag='b_onmouse']").css("background"));
bgw = ($("[caltag='b_onmouse']").css("width"));
bgh = ($("[caltag='b_onmouse']").css("height"));
$(document).ready(function(){
$("[caltag='b_onmouse']").hover(function(){
$(this).css("opacity","0.8");
$(this).css("cursor","pointer");
$(this).attr("bg",bgb).css("background-color","#FFFF93");
//$("div > span").css("position","absolute");
//$("div > span").css("z-index","-1");
$(this).css("position","absolute");
$(this).css("z-index","-1");
},function(){
$(this).css("background",bgb).removeAttr("bg");
$(this).img("width",bgb).removeAttr("bgw");
$(this).img("height",bgh).removeAttr("bgh");
//$("div > span").css("position","static");
//$("div > span").css("z-index","1");
$("this").css("position","static");
$("this").css("z-index","1");
});
})
//怎么都不行呢?求大佬指点.
2.通过这个属性$(document).ready(function(){
$("[caltag='b_onmouse']").hover(function(){
$(this).css("opacity","0.8");
$(this).css("cursor","pointer");
$(this).attr("bg",bgb).css("background-color","#FFFF93");
},function(){
$(this).css("background",bgb).removeAttr("bg");
});
})//hover的时候改变它的背景色现在问题来了
我想要的层是一个呈现在DIV上面的层.怎么办?下面是写的测试代码.bgb = ($("[caltag='b_onmouse']").css("background"));
bgw = ($("[caltag='b_onmouse']").css("width"));
bgh = ($("[caltag='b_onmouse']").css("height"));
$(document).ready(function(){
$("[caltag='b_onmouse']").hover(function(){
$(this).css("opacity","0.8");
$(this).css("cursor","pointer");
$(this).attr("bg",bgb).css("background-color","#FFFF93");
//$("div > span").css("position","absolute");
//$("div > span").css("z-index","-1");
$(this).css("position","absolute");
$(this).css("z-index","-1");
},function(){
$(this).css("background",bgb).removeAttr("bg");
$(this).img("width",bgb).removeAttr("bgw");
$(this).img("height",bgh).removeAttr("bgh");
//$("div > span").css("position","static");
//$("div > span").css("z-index","1");
$("this").css("position","static");
$("this").css("z-index","1");
});
})
//怎么都不行呢?求大佬指点.
解决方案 »
- 在网站中加入地图,哪个地图更好? Google地图?百度地图?...
- 请问这个用JAVASCIPT怎么实现 =========高手请进
- Jscript&javaScript
- 文本框中的内容能不能居中对齐?
- 如何由form object获得其owner document
- 如何通过点击A页面的超链接,把A页面中文本筐中的参数带到B页面中?
- 如何让子窗口永远在父窗口之上?
- 请教:怎样在程序中给元素<input type=file>赋值?
- JAVASCRIPT取数据的问题
- npm安装淘宝镜像出错,网上搜索了一下找不到类似问题的解决办法,求大神帮助
- 在JSP页面用JS控制某个表单的显示与隐藏,但只在IE9下有效,火狐和chrome都无效,求指导
- 判断checkbox的值,是否被选中?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
</head>
<body>
<div caltag="b_onmouse" style="width:500px;height:300px;margin:0 auto;background-color:#ccc;">
123456
</div>
</body>
</html>
<script type="text/javascript">
bgb = ($("[caltag='b_onmouse']").css("background"));
bgw = ($("[caltag='b_onmouse']").css("width"));
bgh = ($("[caltag='b_onmouse']").css("height"));
$(document).ready(function(){
$("[caltag='b_onmouse']").hover(function(){
$(this).css("opacity","0.8");
$(this).css("cursor","pointer");
$(this).attr("bg",bgb).css("background-color","#FFFF93");
//$("div > span").css("position","absolute");
//$("div > span").css("z-index","-1");
//$(this).css("position","absolute");
//$(this).css("z-index","-1");
},function(){
$(this).css("background",bgb).removeAttr("bg");
//$(this).img("width",bgb).removeAttr("bgw");
//$(this).img("height",bgh).removeAttr("bgh");
//$("div > span").css("position","static");
//$("div > span").css("z-index","1");
//$("this").css("position","static");
//$("this").css("z-index","1");
});
})
</script>
想要的效果是,hover层的时 无法选择123456.
<div class="none-select" caltag="b_onmouse" style="width:500px;height:300px;margin:0 auto;background-color:#ccc;">
123456
</div>
<style>
.none-select{
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
-ms-user-select: none; /*IE10*/
-khtml-user-select: none; /*早期浏览器*/
user-select: none;
}
</style>是要一个文字不能选中的效果吗?是不是这样呢,css就可以了