首页 > 编程语言 >js javascript 鼠标触碰select下拉列表渐变出div层,鼠标离开渐变缩回

js javascript 鼠标触碰select下拉列表渐变出div层,鼠标离开渐变缩回

时间:2023-04-27 17:07:00浏览次数:42  
标签:触碰 style 鼠标 oh 渐变 var && ow px


<!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=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>黑色头发</title>
<style type="text/css">
body {
	margin:0px;
}
#but {
	position:relative;
}
#but_temp {
	background:#f3f3f3;
	border:1px solid #ccc;
	font-size:12px;
	position:absolute;
	padding:10px;
	overflow:hidden;
	display:none;
}
</style>
</head>
<body>
<table width='100%'>
<tr>
<td width='200'> </td><td><img src='http://images.51job.com/im/images/select.gif' id='but' /></td>
</tr>
</table>
<div id='but_temp'><a href='http://heisetoufa.iteye.com'>黑色头发</a><img src='http://hao123.com/logox3.gif' /></div>
<script type="text/javascript">
function $(o){
	return document.getElementById(o);
}
var IsStop = false;
var s;
function Show(o){
	var ow = parseInt($(o).style.width);
	var oh = parseInt($(o).style.height);
	if(ow < 200 && IsStop){
		$(o).style.width = ow + 5 + "px";
		$(o).style.height = oh + 2 + "px";
	}
	if(ow > 0 && !IsStop){
		$(o).style.width = ow - 5 + "px";
		$(o).style.height = oh - 2 + "px";
		if(ow == 5){
			$(o).style.display = 'none';
		}
	}
	if(ow >= 0 && ow <= 200){
		s = setTimeout("Show('" + o + "')", 1);
	}
}
function getDefaultStyle(o, a){  
	return o.currentStyle ? o.currentStyle[a] : document.defaultView.getComputedStyle(o, false)[a];
}  
$('but').onmouseover = function(){
	with($('but_temp').style){
		width = '0';
		height = '0';
		top = this.offsetTop + this.offsetHeight + 'px';
		right = document.documentElement.clientWidth - this.offsetLeft - this.offsetWidth + 'px';
		display = 'block';
	}
	IsStop = true;
	s && clearTimeout(s);
	Show('but_temp');
	this.onmouseout = $('but_temp').onmouseout = function(e){
		var e = window.event || e;
		var s = e.toElement || e.relatedTarget;
		if(s != $('but_temp') && s.parentNode != $('but_temp')){
			IsStop = false;
		}
	}
}
</script>
</body>
</html>




黑色头发:http://heisetoufa.iteye.com/


标签:触碰,style,鼠标,oh,渐变,var,&&,ow,px
From: https://blog.51cto.com/u_2543512/6231811

相关文章

  • css渐变实现进度条动画
    <!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=d......
  • 去除echart鼠标经过图表时默认背景黄色问题
    废话不说,上代码:策一://注册mouseover事件,去除hover样式myChart.on("mouseover",function(){myChart.dispatchAction({type:"downplay",})})策二(荐):geo:{emphasis:{disabled:true},}写在最后duang~这时候产品站出来了,说我要在......
  • 如何实现vue项目中使用Baidu Map,有多个点,鼠标移入出现文字标注,移除消失文字标注,并且点
    直接来案例,再分析;<template> <divref="map"style="height:100vh;"></div></template><script>exportdefault{ data(){  return{   points:[    {lng:116.404,lat:39.915,name:'北京天安门......
  • 实现字体颜色渐变
     代码:<divclass="linear">实现字体颜色渐变</div>css:样式.linear{background-image:linear-gradient(136deg,#9A60000%,#53340040%);-webkit-background-clip:text;color:transparent;}插入自己想要的颜色角度等,就可以了 ......
  • 鼠标穿透控制下层窗口的滚动条
    /*应:我怕生!:linux下在非激活的窗口上也能用滚轮.并且窗口不会被提升..我觉得这设置好好哦.可惜Windows下不知道怎么弄.*/;例子:鼠标滚轮穿透控制其下窗体垂直滚动条的位置。;因为焦点控件随时更新,所以需要用到v1.0.43.06+本版中的ControlGetHwnd命令。;ControlGetHwnd命......
  • css盒子跟随鼠标绘制点和线
    <!DOCTYPEhtml><html> <head>  <metacharset="utf-8"/>  <title></title>  <style>   html,body{    width:100%;    height:100%;   }      #box{    height:100px; ......
  • 鼠标绘制实现画画效果
     话不多说直接解释一下:  制作流程  首先我们需要用射线来判断 和需要一个线组件和材质球 才给每次创建的空物体赋值然后需要一个list数组来接收我们每次创建的物体  这个很关系 可以制作成  删除画面内容形成原理:个人理解  : 按钮按下一次 创建......
  • electron鼠标经过托盘显示自定义菜单
    1.自定义菜单//自定义菜单vartemplateMenu=[{label:"首页",submenu:[{label:"111"},{label:'9089'}]},,{label:"编辑",submenu:[{label:'123'}]}]testmenu=Menu.buil......
  • H5页面新增鼠标右击和长按触发事件
    H5页面新增鼠标右击和长按触发事件,不影响点击事件。示例如下:1.新增触发事件<van-cellclass="list-item"v-for="itemindataSource.list":key="item.id"@touchstart="longPress(item,index)"@touchend="removePress(item,index)"......
  • 使用proxy实现一个监听鼠标事件
    由于弹框遮罩层问题,如果绑定鼠标移入移出事件不能顺利,就想着监听鼠标坐标来实现,vue拥有监听器实现简单,就想着用proxy来做一个如下代码<template><divid="x">x:0</div><divid="y">y:0</div><divclass="myDiv"index="1">mydiv1</div&......