成人精品一区二区三区中文字幕-成人精品一区二区三区-成人精品一级毛片-成人精品亚洲-日本在线视频一区二区-日本在线视频免费

導航首頁 ? 技術教程 ? jQuery簡單實現title提示效果示例
全站頭部文字 我要出現在這里
jQuery簡單實現title提示效果示例 678 2024-02-23   

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

/*
調用示例:
$(document).ready(function(){
$('.quicktip').quberTip({
 speed:200
});
});
<a  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程序設計有所幫助。



主站蜘蛛池模板: xiuren秀人网免费| 青山处处埋忠骨课文| 扒开双腿猛进入小柔的扮演者| 池田夏希| 郑艳丽曹查理主演的影片| 正发生电影| 美女绳奴隶| 钱月笙| 徐乃麟个人简历| 山上的小屋免费阅读小说全文| 飞鸟里伊奈| 艳窟神探| 卡卡龙| 王梦婷| 向团组织靠拢的打算| 雪肌夜叉| 瓶邪图片| 假如我是一坨屎作文| 49图库龙门客栈| 张志忠演员| 人蛇大战 电影| 罗马之春| 少爷爱上保镖泰剧双男主| 《暗恋电影》在线观看| 性视频网站在线| 路易德菲耐斯| 韩国电影《甜性涩爱》| 汪汪队100集全免费| 热血高校 电影| 7妹| 乔治克鲁尼身高| 台湾卫视| 寡妇电影| 找保姆| 买买提个人资料简历| 山上的小屋 残雪原文| 蒋祖曼| 影子人| 黎小军| 酱园弄 电影| 欧美成熟|

!!!站長長期在線接!!!

網站、小程序:定制開發/二次開發/仿制開發等

各種疑難雜癥解決/定制接口/定制采集等

站長微信:lxwl520520

站長QQ:1737366103