tooltip动态提示框js代码

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 tooltip动态提示框js代码 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

tooltip动态提示框js代码

HTML代码(index.html):

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>tooltip动态提示框</title>
<style type="text/css">
body {
	margin: 0; padding: 0;
	font: normal 12px Verdana, Geneva, sans-serif;
	line-height: 1.8em;
	color: #333;
}
* {outline: none;}
img {border: none;}
h1 {
	font: 4em normal Georgia, 'Times New Roman', Times, serif;
	padding: 10px 0;
	color: #aaa;
	text-align: center;
}
h1 span { color: #666; }
h1 small{
	font: 0.3em normal Verdana, Arial, Helvetica, sans-serif;
	text-transform:uppercase;
	letter-spacing: 0.65em;
	display: block;
	color: #666;
}
h1 a {text-decoration: none;}
a {color: #d60000; text-decoration: none;}

/*--Tooltip Styles--*/
.tip {
	color: #fff;
	background:#1d1d1d;
	display:none; /*--Hides by default--*/
	padding:10px;
	position:absolute;	z-index:1000;
	-webkit-border-radius: 3px;
	-moz-border-radius: 3px;
	border-radius: 3px;
}
.container {width: 960px; margin: 0 auto; overflow: hidden;}
</style>

</head>

<body>


<script type="text/javascript" src="js/jquery.min.js"></script> 
<script type="text/javascript">
$(document).ready(function() {
	//Tooltips
	$(".tip_trigger").hover(function(){
		tip = $(this).find('.tip');
		tip.show(); //Show tooltip
	}, function() {
		tip.hide(); //Hide tooltip		  
	}).mousemove(function(e) {
		var mousex = e.pageX + 20; //Get X coodrinates
		var mousey = e.pageY + 20; //Get Y coordinates
		var tipWidth = tip.width(); //Find width of tooltip
		var tipHeight = tip.height(); //Find height of tooltip
		
		//Distance of element from the right edge of viewport
		var tipVisX = $(window).width() - (mousex + tipWidth);
		//Distance of element from the bottom of viewport
		var tipVisY = $(window).height() - (mousey + tipHeight);
		  
		if ( tipVisX < 20 ) { //If tooltip exceeds the X coordinate of viewport
			mousex = e.pageX - tipWidth - 20;
		} if ( tipVisY < 20 ) { //If tooltip exceeds the Y coordinate of viewport
			mousey = e.pageY - tipHeight - 20;
		} 
		tip.css({  top: mousey, left: mousex });
	});
});

</script>
<div class="container">
	<h1>tooltip动态提示框</h1>
    <a href="#" target="_blank" class="tip_trigger" style="float: left; margin: 5px 20px 20px 0; padding: 10px; border: 1px dashed #ddd;">
        <img src="img/4_s.gif" alt=""/>
        <span class="tip"><img src="img/4_b.jpg" height="250" alt="" /></span> 
    </a>

    <p>Ut dolus ullamcorper, gravis ad eu typicus. Similis nulla augue aliquam importunus eu, dolor erat letalis persto. Autem qui, vel patria elit refero si. Letalis augue accumsan vulputate aptent vel aptent iusto ullamcorper vero. delenit hos dolore occuro tation euismod eum quadrum si nulla saepius nutus wisi foras. Commodo <a class="tip_trigger" href="#">Paulatim <span class="tip" style="width: 400px;"><img src="img/pic_mont.jpg" style="float: left; margin-right: 20px;" alt="" />Welcome to Grandpeople. We specialize in graphic design, photography, illustration and creative direction. Feel free to have a look at our selected work for clients and collaborators from around the globe.</span></a></p>
    
    <p>Jumentum in, premo pertineo valde mara velit haero ulciscor abigo commodo vulputate volutpat. In typicus luptatum, nutus, ne letalis vel ventosus. Hendrerit <a class="tip_trigger" href="#">aliquam <span class="tip" style="width: 450px;"><img src="img/pic_mgmt.jpg" style="float: left; margin-right: 20px;" alt="" />
We build fresh websites and amazing community solutions. Amazee Labs at your service! Based on the modern open source framework Drupal we bring your brand to the online world. With competence, confidence and a dash of spice! </span></a> eros eum eu laoreet, minim, probo. Duis nibh in huic abico duis enim oppeto. </p>	
    
    <p>Jumentum in, premo pertineo valde mara velit haero ulciscor abigo commodo vulputate volutpat. In typicus luptatum, nutus, ne letalis vel ventosus. Hendrerit aliquam eros eum eu laoreet, minim, probo. Duis nibh in huic abico duis enim oppeto. <a href="#" class="tip_trigger">Your Link Key Word <span class="tip">This will show up in the tooltip</span></a></p>	
    
</div>
</body>
</html>
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
195.65 KB
jquery特效9
最新结算
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jquery虚拟键盘中文打字效果js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
HTML5实现CSS滤镜图片切换特效代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery头像裁剪插件cropbox js代码
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
CSS3制作3D图片立方体旋转特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
jQuery+css3实现信封效果
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章