国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jQuery簡單實現title提示效果示例

2019-11-20 09:21:29
字體:
來源:轉載
供稿:網友

本文實例講述了jQuery簡單實現title提示效果的方法。分享給大家供大家參考,具體如下:

/*調用示例:$(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");      });    }  });};

更多關于jQuery相關內容感興趣的讀者可查看本站專題:《jQuery常用插件及用法總結》、《jQuery form操作技巧匯總》、《jQuery操作json數據技巧匯總》、《jQuery擴展技巧總結》、《jQuery拖拽特效與技巧總結》、《jQuery表格(table)操作技巧匯總》、《jquery中Ajax用法總結》、《jQuery常見經典特效匯總》、《jQuery動畫與特效用法總結》及《jquery選擇器用法總結

希望本文所述對大家jQuery程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新津县| 宝兴县| 虹口区| 运城市| 当涂县| 广南县| 寿宁县| 保定市| 响水县| 张家港市| 丹江口市| 芦山县| 湖口县| 阜南县| 嫩江县| 瑞安市| 罗山县| 余姚市| 漾濞| 连州市| 塔河县| 邻水| 凌海市| 渝中区| 东安县| 家居| 黎城县| 河南省| 金堂县| 吴川市| 临桂县| 广汉市| 克山县| 涡阳县| 陇川县| 山阴县| 包头市| 五莲县| 惠东县| 峡江县| 朝阳市|