jQuery簡單實(shí)現(xiàn)title提示效果示例
本文實(shí)例講述了jQuery簡單實(shí)現(xiàn)title提示效果的方法。分享給大家供大家參考,具體如下:
/*
調(diào)用示例:
$(document).ready(function(){
$('.quicktip').quberTip({
speed:200
});
});
<a href='' class='quicktip' title='Information about this link'>desktop publishing</a>
*/
jQuery.fn.quberTip = function (options) {
var defaults = {
speed: 500,
xOffset: 10,
yOffset: 10
};
var options = $.extend(defaults, options);
return this.each(function () {
var $this = jQuery(this);
if ($this.attr('title') != undefined) {
//Pass the title to a variable and then remove it from DOM
if ($this.attr('title') != '') {
var tipTitle = ($this.attr('title'));
} else {
var tipTitle = 'QuberTip';
}
//Remove title attribute
$this.removeAttr('title');
$(this).hover(function (e) {
// $(this).css('cursor', 'pointer');
$("body").append("<div id='tooltip'>" + tipTitle + "</div>");
$("#tooltip").css({ "position": "absolute",
"z-index": "9999",
"background": "#D3DDF5",
"background-image": "url(../../Quber_Image/Quber_Common/Quber_TB_TitltBG.png)",
"padding": "5px",
"opacity": "0.9",
"border": "1px solid #A3C0E8",
"-moz-border-radius": "3px",
"border-radius": "3px",
"-webkit-border-radius": "3px",
"font-weight": "normal",
"font-size": "12px",
"display": "none"
});
$("#tooltip")
.css("top", (e.pageY + defaults.xOffset) + "px")
.css("left", (e.pageX + defaults.yOffset) + "px")
.fadeIn(options.speed);
}, function () {
//Remove the tooltip from the DOM
$("#tooltip").remove();
});
$(this).mousemove(function (e) {
$("#tooltip")
.css("top", (e.pageY + defaults.xOffset) + "px")
.css("left", (e.pageX + defaults.yOffset) + "px");
});
}
});
};
更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery常用插件及用法總結(jié)》、《jQuery form操作技巧匯總》、《jQuery操作json數(shù)據(jù)技巧匯總》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jquery中Ajax用法總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery動(dòng)畫與特效用法總結(jié)》及《jquery選擇器用法總結(jié)》
希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。
- JQuery實(shí)現(xiàn)超鏈接鼠標(biāo)提示效果的方法
- jquery實(shí)現(xiàn)網(wǎng)站超鏈接和圖片提示效果
- jQuery文字提示與圖片提示效果實(shí)現(xiàn)方法
- jquery實(shí)現(xiàn)簡單文字提示效果
- jQuery實(shí)現(xiàn)仿QQ空間裝扮預(yù)覽圖片的鼠標(biāo)提示效果代碼
- jquery實(shí)現(xiàn)鼠標(biāo)滑過后動(dòng)態(tài)圖片提示效果實(shí)例
- jQuery實(shí)現(xiàn)行文字鏈接提示效果的方法
- jquery刪除數(shù)據(jù)記錄時(shí)的彈出提示效果
- jQuery表單獲取和失去焦點(diǎn)輸入框提示效果的實(shí)例代碼
- jQuery實(shí)現(xiàn)的超鏈接提示效果示例【附demo源碼下載】
相關(guān)文章
jQuery實(shí)現(xiàn)的簡單手風(fēng)琴效果示例
這篇文章主要介紹了jQuery實(shí)現(xiàn)的簡單手風(fēng)琴效果,結(jié)合實(shí)例形式分析了jQuery基于事件響應(yīng)、頁面元素屬性動(dòng)態(tài)操作實(shí)現(xiàn)手風(fēng)琴效果的方法,需要的朋友可以參考下2018-08-08
JQuery 1.3.2以上版本中出現(xiàn)pareseerror錯(cuò)誤的解決方法
最近正在做一個(gè)系統(tǒng),測試組那邊不停的報(bào)告bug:后臺(tái)、前臺(tái)各種列表報(bào)告js彈出窗錯(cuò)誤,內(nèi)容僅僅是一句“pareseerror”!2011-01-01
動(dòng)態(tài)設(shè)置form表單的action屬性的值的簡單方法
下面小編就為大家?guī)硪黄獎(jiǎng)討B(tài)設(shè)置form表單的action屬性的值的簡單方法。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2016-05-05
jQuery獲取當(dāng)前點(diǎn)擊的對(duì)象元素(實(shí)現(xiàn)代碼)
下面小編就為大家?guī)硪黄猨Query獲取當(dāng)前點(diǎn)擊的對(duì)象元素(實(shí)現(xiàn)代碼)。小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考,一起跟隨小編過來看看吧2016-05-05
基于jquery-resizable創(chuàng)建可調(diào)整大小的表(table)格
本文介紹如何基于jquery-resizable實(shí)現(xiàn)可調(diào)整表格(table)列寬的代碼,需要的朋友可以參考下2023-06-06

