jQuery實(shí)現(xiàn)行文字鏈接提示效果的方法
更新時(shí)間:2015年03月10日 10:24:58 作者:hcqenjoy
這篇文章主要介紹了jQuery實(shí)現(xiàn)行文字鏈接提示效果的方法,實(shí)例分析了jQuery操作文字提示效果的方法,具有一定參考借鑒價(jià)值,需要的朋友可以參考下
本文實(shí)例講述了jQuery實(shí)現(xiàn)行文字鏈接提示效果的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
復(fù)制代碼 代碼如下:
<!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" />
<title>一行文字的提示效果</title>
<script type='text/javascript' src='/ajaxjs/jquery1.3.2.js'></script>
<script type="text/javascript">
$(function(){
$(".div ul li").hover(function(e){
var x=e.pageX;
var y=e.pageY;
var div=$("<div id='div_show'></div>");
var text=$(this).html();
$(this).append(div);
$("#div_show").html(text).css({"height":"25px","position":"absolute","zIndex":"99","backgroundColor":"#38F758","whiteSpace":"nowrap","paddingLeft":"15px","paddingRight":"15px","top":y+10+"px","left":x+10+"px"});
$("this").children("#div_show").show();
},function(){
$(this).children("#div_show").remove();
})
})
</script>
<style type="text/css">
ul{ margin:0; padding:0;}
ul li{ list-style:none;}
.div{ width:200px; float:left; display:inline; }
.div ul li{ width:220px; padding:0px 6px; line-height:25px; height:25px; margin-top:1px; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
</style>
</head>
<body>
<div class="div">
<ul>
<li>好吧,現(xiàn)在流行HTML5,我就給它標(biāo)題加上個(gè)HTML5吧</li>
<li>Raphael js庫是在webrebuild交流會(huì)上聽到的</li>
<li>我們來簡(jiǎn)單了解一下上文中提到的css appearance</li>
</ul>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>一行文字的提示效果</title>
<script type='text/javascript' src='/ajaxjs/jquery1.3.2.js'></script>
<script type="text/javascript">
$(function(){
$(".div ul li").hover(function(e){
var x=e.pageX;
var y=e.pageY;
var div=$("<div id='div_show'></div>");
var text=$(this).html();
$(this).append(div);
$("#div_show").html(text).css({"height":"25px","position":"absolute","zIndex":"99","backgroundColor":"#38F758","whiteSpace":"nowrap","paddingLeft":"15px","paddingRight":"15px","top":y+10+"px","left":x+10+"px"});
$("this").children("#div_show").show();
},function(){
$(this).children("#div_show").remove();
})
})
</script>
<style type="text/css">
ul{ margin:0; padding:0;}
ul li{ list-style:none;}
.div{ width:200px; float:left; display:inline; }
.div ul li{ width:220px; padding:0px 6px; line-height:25px; height:25px; margin-top:1px; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
</style>
</head>
<body>
<div class="div">
<ul>
<li>好吧,現(xiàn)在流行HTML5,我就給它標(biāo)題加上個(gè)HTML5吧</li>
<li>Raphael js庫是在webrebuild交流會(huì)上聽到的</li>
<li>我們來簡(jiǎn)單了解一下上文中提到的css appearance</li>
</ul>
</div>
</body>
</html>
希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。
您可能感興趣的文章:
- JQuery實(shí)現(xiàn)超鏈接鼠標(biāo)提示效果的方法
- jquery實(shí)現(xiàn)網(wǎng)站超鏈接和圖片提示效果
- jQuery簡(jiǎn)單實(shí)現(xiàn)title提示效果示例
- jQuery文字提示與圖片提示效果實(shí)現(xiàn)方法
- jquery實(shí)現(xiàn)簡(jiǎn)單文字提示效果
- jQuery實(shí)現(xiàn)仿QQ空間裝扮預(yù)覽圖片的鼠標(biāo)提示效果代碼
- jquery實(shí)現(xiàn)鼠標(biāo)滑過后動(dòng)態(tài)圖片提示效果實(shí)例
- jquery刪除數(shù)據(jù)記錄時(shí)的彈出提示效果
- jQuery表單獲取和失去焦點(diǎn)輸入框提示效果的實(shí)例代碼
- jQuery實(shí)現(xiàn)的超鏈接提示效果示例【附demo源碼下載】
相關(guān)文章
jQuery事件注冊(cè)的實(shí)現(xiàn)示范
jQuery為我們提供了方便的事件注冊(cè)機(jī)制,它的優(yōu)點(diǎn),操作簡(jiǎn)單,且不用擔(dān)心事件覆蓋等問題。缺點(diǎn),普通的事件注冊(cè)不能做事件委托,且無法實(shí)現(xiàn)事件解綁,需要借助其他方法2022-07-07
jQuery實(shí)現(xiàn)貪吃蛇小游戲(附源碼下載)
網(wǎng)上關(guān)于JS實(shí)現(xiàn)貪吃蛇的文章有很多,最近閑來無事,想著利用jQury來實(shí)現(xiàn)貪吃蛇小游戲,下面實(shí)現(xiàn)這篇文章主要介紹了利用jQuery實(shí)現(xiàn)貪吃蛇小游戲的方法,文中給出的是吸納思路和示例代碼,需要的朋友可以參考下。2017-03-03
jquery實(shí)現(xiàn)吸頂導(dǎo)航效果
這篇文章主要為大家詳細(xì)介紹了jquery實(shí)現(xiàn)吸頂導(dǎo)航效果,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-01-01
Jquery Ajax 學(xué)習(xí)實(shí)例2 向頁面發(fā)出請(qǐng)求 返回JSon格式數(shù)據(jù)
處理業(yè)務(wù)數(shù)據(jù),產(chǎn)生JSon數(shù)據(jù),供JqueryRequest.aspx調(diào)用2010-03-03

