{"id":642,"date":"2008-12-12T23:12:38","date_gmt":"2008-12-12T15:12:38","guid":{"rendered":"http:\/\/fdream.net\/blog\/article\/642.aspx"},"modified":"2008-12-13T14:12:22","modified_gmt":"2008-12-13T06:12:22","slug":"Mootools+1.2%e6%95%99%e7%a8%8b(19)%e2%80%94%e2%80%94Tooltips","status":"publish","type":"post","link":"https:\/\/fdream.net\/blog\/article\/642","title":{"rendered":"Mootools 1.2\u6559\u7a0b(19)\u2014\u2014Tooltips"},"content":{"rendered":"<p>\u539f\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.consideropen.com\/blog\/2008\/09\/30-days-of-mootools-12-tutorials-day-19-tooltips\/\" target=\"_blank\" title=\"30 Days of Mootools 1.2 Tutorials - Day 19 - Tooltips\">30 Days of Mootools 1.2 Tutorials &#8211; Day 19 &#8211; Tooltips<\/a><\/p>\n<h2>Mootools 1.2\u5de5\u5177\u63d0\u793a\uff08tooltip\uff09\u6559\u7a0b<\/h2>\n<p>\u8bf7\u5c0a\u91cd\u4e2a\u4eba\u52b3\u52a8\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\uff1ahttp:\/\/fdream.net\uff0c\u8bd1\u8005\uff1aFdream<\/p>\n<p>\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u51c6\u5907\u597d\u5f00\u59cb\u8fd9\u4e00\u8bb2\uff0c\u8bf7\u53c2\u8003\u8fd9\u4e00\u7cfb\u5217\u7684\u6559\u7a0b\uff0c\u8fd9\u91cc\u662f<a href=\"http:\/\/fdream.net\/blog\/article\/605.aspx\" target=\"_blank\" title=\"\u300aMooTools 1.2\u7cfb\u5217\u6559\u7a0b\u76ee\u5f55\u300b\">\u300aMooTools 1.2\u7cfb\u5217\u6559\u7a0b\u76ee\u5f55\u300b<\/a>\u3002<\/p>\n<p>\u4eca\u5929\u6211\u4eec\u5c06\u6765\u770b\u4e00\u4e0bMooTools\u7ed1\u5b9a\u7684Tooltip\u63d2\u4ef6\u3002\u901a\u8fc7\u201c\u63d0\u793a\uff08Tips\uff09\u201d\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u81ea\u5b9a\u4e49\u4e00\u4e2a\u5305\u542b\u4e00\u4e2a\u6807\u9898\u548c\u5185\u5bb9\u7684\u5de5\u5177\u63d0\u793a\uff0c\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6837\u5f0f\uff0c\u81ea\u5b9a\u4e49\u6de1\u5165\u6de1\u51fa\u6e10\u53d8\u6548\u679c\u3002\u6211\u4eec\u8fd8\u5c06\u4ed4\u7ec6\u5b66\u4e60\u4e00\u4e0b\u5de5\u5177\u63d0\u793a\u7684\u9009\u9879\u548c\u4e8b\u4ef6\uff0c\u8fd8\u6709\u4e00\u4e9b\u7528\u6765\u4ece\u5143\u7d20\u4e0a\u6dfb\u52a0\u548c\u79fb\u9664\u5de5\u5177\u63d0\u793a\u7684\u5de5\u5177\u3002\u6700\u540e\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u4e00\u4e0b\u600e\u4e48\u8ba9\u4e00\u4e2a\u9875\u9762\u6709\u591a\u4e2a\u4e0d\u540c\u6837\u5f0f\u7684\u5de5\u5177\u63d0\u793a\u3002<\/p>\n<h3>\u57fa\u7840\u77e5\u8bc6<\/h3>\n<h4>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5de5\u5177\u63d0\u793a<\/h4>\n<p>\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5de5\u5177\u63d0\u793a\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\uff0c\u6211\u4eec\u6765\u521b\u5efa\u4e00\u4e2a\u8981\u6dfb\u52a0\u5de5\u5177\u63d0\u793a\u7684\u94fe\u63a5\uff1a<\/p>\n<p><pre lang=\"html\">\n&lt;a class=&quot;tooltipA&quot; title=&quot;1st Tooltip Title&quot; rel=&quot;here is the default 'text' of 1&quot; href=&quot;http:\/\/www.consideropen.com&quot;&gt;Tool tip 1&lt;\/a&gt;\n<\/pre>\n<\/p>\n<p>MooTools 1.2\u5de5\u5177\u63d0\u793a\u5c06\u9ed8\u8ba4\u663e\u793a\u94fe\u63a5\u4e2d\u7684title\u548crel\u5c5e\u6027\u7684\u503c\u3002\u5982\u679c\u6ca1\u6709rel\u5c5e\u6027\uff0c\u5c06\u663e\u793ahref\u5c5e\u6027\u503c\u3002<\/p>\n<p>\u73b0\u5728\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u9ed8\u8ba4\u5de5\u5177\u6761\u63d0\u793a\uff1a<\/p>\n<p><pre lang=\"javascript\">\nvar customTips = $$('.tooltipA');\nvar toolTips = new Tips(customTips);\n<\/pre>\n<\/p>\n<p>\u7531\u4e8e\u6ca1\u6709\u4f7f\u7528\u4efb\u4f55\u6837\u5f0f\uff0c\u4f60\u5c06\u770b\u5230\u4e0b\u9762\u8fd9\u6837\u7684\u5de5\u5177\u63d0\u793a\uff1a<\/p>\n<p>\n<script type=\"text\/javascript\">\nwindow.addEvent('domready', function() {\nvar customTipsA = $$('.tooltipA');\nvar toolTipsA = new Tips(customTipsA);<\/p>\n<p>var customTipsB = $$('.tooltipB');\nvar toolTipsB = new Tips(customTipsB, {\n    className: 'custom_tip'\n});<\/p>\n<p>var customTips = $$('.tooltip');<\/p>\n<p>var toolTips = new Tips(customTips, {\n    showDelay: 1000,\n    hideDelay: 100,  \n    className: 'anything', \n    offsets: {\n        'x': 100, \n        'y': 16 \n    },\n     fixed: false,\n    onShow: function(toolTipElement){\n            toolTipElement.fade(.8);\n        $('show').highlight('#FFF504');\n    },\n    onHide: function(toolTipElement){\n        toolTipElement.fade(0);\n        $('hide').highlight('#FFF504');\n    }\n});<\/p>\n<p>var toolTipsTwo = new Tips('.tooltip2', {    \n    className: 'something_else', \/\/default is null\n});<\/p>\n<p>$('tooltipID1').store('tip:text', 'You can replace the href with whatever text you want.');\n$('tooltipID1').store('tip:title', 'Here is a new title.');<\/p>\n<p>$('tooltipID1').set('rel', 'This will not change the tooltips text');\n$('tooltipID1').set('title', 'This will not change the tooltips title');<\/p>\n<p>toolTips.detach('#tooltipID2');\ntoolTips.detach('#tooltipID4');\ntoolTips.attach('#tooltipID4'); <\/p>\n<p>});\n<\/script><\/p>\n<style type=\"text\/css\"> \n.tip{background-color: #333;padding: 5px;} \n.something_else .tip {background-color: #993300;} \n.something_else .tip-title {background-color: #0000CC;} \n.tip-title {color: #fff;background-color: #666;font-size: 20px;padding: 5px;} \n.tip-text{color: #fff;padding: 5px;} \n.ind{width:200px;background-color:#666;color:white;padding:15px;border-bottom:1px solid white;} \n#hide {margin-bottom: 20px;}\n.custom_tip .tip {background-color: #333;padding: 5px;} \n.custom_tip .tip-title {color: #fff;background-color: #666;font-size: 20px;padding: 5px;}\n.custom_tip .tip-text {color: #fff;padding: 5px;}\n<\/style>\n<p><a class=\"tooltipA\" title=\"\u7b2c\u4e00\u4e2aTooltip\u6807\u9898\" rel=\"here is the default 'text' of 1\" href=\"http:\/\/www.consideropen.com\">Tool tip 1<\/a>\n<\/p>\n<h4>\u4e3a\u4f60\u7684\u5de5\u5177\u63d0\u793a\u4f7f\u7528\u6837\u5f0f<\/h4>\n<p>MooTools\u53ef\u4ee5\u8ba9\u4f60\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u63a7\u5236\u5b83\u7684\u8f93\u51fa\u2014\u2014\u6211\u4eec\u6765\u770b\u4e00\u4e0b\u5de5\u5177\u63d0\u793a\u7684html\u4ee3\u7801\uff1a<\/p>\n<p><pre lang=\"html\">\n\/\/ \u4f60\u53ef\u4ee5\u5728options\u4e2d\u6307\u5b9a\n\/\/ \u5de5\u5177\u63d0\u793a\u5bb9\u5668\u7684CSS\u7c7b\u540d\n&lt;div class=&quot;options.className&quot;&gt;\n&lt;div class=&quot;tip&quot;&gt;&lt;\/div&gt;\n&lt;\/div&gt;\n<\/pre>\n<\/p>\n<p>\u7559\u610f\u4e00\u4e0b\u9876\u90e8\u548c\u5e95\u90e8\u7684div\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u5b83\u4eec\u6765\u8f7b\u677e\u5730\u5728\u9876\u90e8\u548c\u5e95\u90e8\u6dfb\u52a0\u5706\u89d2\uff0c\u6216\u8005\u5176\u4ed6\u6837\u5f0f\u6548\u679c\u3002<\/p>\n<p>\u73b0\u5728\uff0c\u8ba9\u6211\u4eec\u6765\u521b\u5efa\u4e00\u4e2a\u6211\u4eec\u7684\u7b2c\u4e00\u4e2a\u9009\u9879\u5e76\u6dfb\u52a0\u4e00\u4e9bCSS\u3002\u4e0a\u9762\u7684html\u4ee3\u7801\u5c06\u7528\u540d\u4e3a\u201coptions.className\u201d\u7684CSS\u6837\u5f0f\u6765\u6e32\u67d3\u3002\u901a\u8fc7\u7ed9\u6211\u4eec\u7684\u5de5\u5177\u63d0\u793a\u6765\u6307\u5b9a\u4e00\u4e2aCSS\u7c7b\u540d\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u7ed9\u5b83\u4e00\u4e2a\u72ec\u7acb\u7684\u6837\u5f0f\u800c\u4e0d\u4f1a\u5f71\u54cd\u9875\u9762\u4e0a\u7684\u5176\u4ed6MooTools\u5de5\u5177\u63d0\u793a\u3002<\/p>\n<p><pre lang=\"javascript\">\nvar customTipsB = $$('.tooltipB');\nvar toolTipsB = new Tips(customTipsB, {\n    className: 'custom_tip'\n});\n<\/pre>\n<\/p>\n<p>\u6700\u540e\uff0c\u6211\u4eec\u518d\u6dfb\u52a0\u4e00\u4e9bCSS\uff1a<\/p>\n<p><pre lang=\"css\">\n.custom_tip .tip {\n    background-color: #333\n    padding: 5px\n}\n \n.custom_tip .tip-title {\n    color: #fff\n    background-color: #666\n    font-size: 20px\n    padding: 5px\n}\n \n.custom_tip .tip-text {\n    color: #fff\n    padding: 5px\n}\n<\/pre>\n<\/p>\n<p>\n<a class=\"tooltipB\" title=\"\u7b2c\u4e8c\u4e2aTooltip\u6807\u9898\" rel=\"here is the default 'text' of 2\" href=\"http:\/\/www.consideropen.com\">Tool tip 2<\/a>\n<\/p>\n<h3>\u9009\u9879<\/h3>\n<p>\u5728Tips\u7c7b\u4e2d\u603b\u5171\u53ea\u6709\u4e94\u4e2a\u9009\u9879\uff0c\u6bcf\u4e2a\u90fd\u6709\u5f88\u597d\u7684\u81ea\u89e3\u91ca\u6027\uff08\u4e5f\u5c31\u662f\u4e00\u770b\u5c31\u660e\u767d\u4ec0\u4e48\u610f\u601d\u4e86\uff09\u3002<\/p>\n<h4>showDelay<\/h4>\n<p>\u9ed8\u8ba4\u503c\u4e3a100<\/p>\n<p>\u4e00\u4e2a\u4ee5\u6beb\u79d2\u4e3a\u5355\u4f4d\u7684\u6574\u6570\uff0c\u8fd9\u5c06\u51b3\u5b9a\u5de5\u5177\u63d0\u793a\u5728\u9f20\u6807\u79fb\u52a8\u5230\u5143\u7d20\u4e0a\u9762\u591a\u4e45\u540e\u518d\u663e\u793a\u51fa\u6765\u3002<\/p>\n<h4>hideDelay<\/h4>\n<p>\u9ed8\u8ba4\u503c\u4e3a100<\/p>\n<p>\u548c\u4e0a\u9762\u7684showDelay\u4e00\u6837\uff0c\u4e0d\u8fc7\u8fd9\u4e2a\u503c\uff08\u4e5f\u662f\u4ee5\u6beb\u79d2\u4e3a\u5355\u4f4d\uff09\u5c06\u51b3\u5b9a\u5f53\u9f20\u6807\u79bb\u5f00\u5143\u7d20\u591a\u4e45\u4ee5\u540e\u9690\u85cf\u5de5\u5177\u63d0\u793a\u3002<\/p>\n<h4>className<\/h4>\n<p>\u9ed8\u8ba4\u4e3anull<\/p>\n<p>\u5c31\u50cf\u4f60\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\u770b\u5230\u7684\u4e00\u6837\uff0c\u8fd9\u53ef\u4ee5\u8ba9\u4f60\u4e3a\u5de5\u5177\u63d0\u793a\u5bb9\u5668\u8bbe\u7f6e\u4e00\u4e2aCSS\u7c7b\u540d\u3002<\/p>\n<h4>offsets<\/h4>\n<p>\u9ed8\u8ba4\u4e3a x:16, y:16<\/p>\n<p>\u8fd9\u5c06\u51b3\u5b9a\u5de5\u5177\u63d0\u793a\u79bb\u4f60\u7684\u5143\u7d20\u7684\u8ddd\u79bb\uff0cx\u503c\u4e3a\u79bb\u5143\u7d20\u5f80\u53f3\u7684\u8ddd\u79bb\uff0cy\u4e3a\u79bb\u5143\u7d20\u5f80\u4e0b\u7684\u8ddd\u79bb\uff08\u5982\u679c\u6307\u5b9a\u4e86fixed\u9009\u9879\u4e3afalse\uff0c\u5c06\u662f\u76f8\u5bf9\u4e8e\u9f20\u6807\u6307\u9488\u7684\u8ddd\u79bb\uff0c\u5426\u5219\u5c06\u662f\u76f8\u5bf9\u4e8e\u5143\u7d20\u7684\u8ddd\u79bb\uff09\u3002<\/p>\n<h4>fixed<\/h4>\n<p>\u9ed8\u8ba4\u4e3afalse<\/p>\n<p>\u8fd9\u4e2a\u8bbe\u7f6e\u51b3\u5b9a\u4e86\u5f53\u4f60\u7684\u9f20\u6807\u5728\u5143\u7d20\u4e0a\u9762\u79fb\u52a8\u65f6\uff0c\u8fd9\u4e2a\u5de5\u5177\u63d0\u793a\u662f\u5426\u8ddf\u968f\u9f20\u6807\u3002\u5982\u679c\u8bbe\u7f6e\u4e3atrue\uff0c\u5de5\u5177\u63d0\u793a\u5c06\u4e0d\u968f\u9f20\u6807\u6307\u9488\u7684\u79fb\u52a8\u800c\u79fb\u52a8\uff0c\u800c\u53ea\u662f\u505c\u7559\u5728\u5143\u7d20\u7684\u9644\u8fd1\u56fa\u5b9a\u7684\u4f4d\u7f6e\u3002<\/p>\n<h3>\u4e8b\u4ef6<\/h3>\n<p>\u548c\u8fd9\u4e2a\u7c7b\u7684\u5176\u4ed6\u4e1c\u897f\u4e00\u6837\uff0c\u5de5\u5177\u63d0\u793a\u7684\u4e8b\u4ef6\u4ecd\u7136\u975e\u5e38\u7b80\u5355\u3002\u5b83\u6709\u4e24\u4e2a\u4e8b\u4ef6\uff1aonShow\u548conHide\uff0c\u5b83\u4eec\u5c06\u4f1a\u50cf\u4f60\u671f\u5f85\u7684\u90a3\u6837\u5de5\u4f5c\u3002<\/p>\n<h4>onShow<\/h4>\n<p>\u8fd9\u4e2a\u4e8b\u4ef6\u5c06\u5728\u5de5\u5177\u6761\u663e\u793a\u7684\u65f6\u5019\u89e6\u53d1\u3002\u5982\u679c\u4f60\u8bbe\u7f6e\u4e86\u5ef6\u65f6\uff0c\u8fd9\u4e2a\u4e8b\u4ef6\u5c06\u5728\u76f4\u5230\u5de5\u5177\u63d0\u793a\u663e\u793a\u51fa\u6765\u65f6\u89e6\u53d1\u3002<\/p>\n<h4>onHide<\/h4>\n<p>\u548c\u4e0a\u9762\u7684onShow\u4e8b\u4ef6\u4e00\u6837\uff0c\u76f8\u5bf9\u5730\uff0c\u5b83\u662f\u5728\u5de5\u5177\u63d0\u793a\u9690\u85cf\u65f6\u89e6\u53d1\u3002\u5982\u679c\u8bbe\u7f6e\u4e86\u5ef6\u65f6\uff0c\u8fd9\u4e2a\u4e8b\u4ef6\u4e5f\u5c06\u5728\u76f4\u5230\u5de5\u5177\u63d0\u793a\u9690\u85cf\u8d77\u6765\u65f6\u89e6\u53d1\u3002<\/p>\n<h3>\u65b9\u6cd5<\/h3>\n<p>Tips\u7c7b\u6709\u4e24\u4e2a\u65b9\u6cd5\u2014\u2014attach\u548cdettach\uff0c\u901a\u8fc7\u8fd9\u4e24\u4e2a\u65b9\u6cd5\uff0c\u4f60\u53ef\u4ee5\u7ed9\u4e00\u4e2a\u6307\u5b9a\u7684\u5143\u7d20\u6dfb\u52a0\u4e00\u4e2a\u5de5\u5177\u63d0\u793a\uff08\u5f53\u7136\u4e86\uff0c\u8fd9\u4e9b\u5de5\u5177\u63d0\u793a\u4f1a\u6709\u76f8\u540c\u7684\u8bbe\u7f6e\uff09\uff0c\u6216\u8005\u4ece\u4e00\u4e2a\u7279\u5b9a\u7684\u5143\u7d20\u4e0a\u79fb\u9664\u5de5\u5177\u63d0\u793a\u3002<\/p>\n<h4>.attach();<\/h4>\n<p>\u8981\u7ed9\u4e00\u4e2a\u65b0\u7684\u5143\u7d20\u6dfb\u52a0\u4e00\u4e2a\u5de5\u5177\u63d0\u793a\uff0c\u4f60\u53ea\u9700\u8981\u5728Tip\u5bf9\u8c61\u7684\u540e\u9762\u52a0\u4e0a.attach();\uff0c\u6700\u540e\u518d\u628a\u8fd9\u4e2a\u5143\u7d20\u7684\u9009\u62e9\u5668\u653e\u5728\u62ec\u53f7\u91cc\u9762\u3002<\/p>\n<p><pre lang=\"javascript\">\ntoolTips.attach('#tooltipID3');\n<\/pre>\n<\/p>\n<h4>.dettach();<\/h4>\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u548c.attach\u65b9\u6cd5\u4e00\u6837\uff0c\u4e0d\u8fc7\u5b83\u4eec\u7684\u884c\u4e3a\u5b8c\u5168\u76f8\u53cd\u3002\u9996\u5148\uff0c\u5199\u4e0bTip\u5bf9\u8c61\uff0c\u7136\u540e\u5728\u8fd9\u4e2a\u5143\u7d20\u7684\u540e\u9762\u6dfb\u52a0\u4e0a.dettach()\uff1b\uff0c\u6700\u540e\u628a\u8fd9\u4e2a\u5143\u7d20\u7684\u9009\u62e9\u5668\u653e\u5728\u62ec\u53f7\u91cc\u9762\u3002<\/p>\n<p><pre lang=\"javascript\">\ntoolTips.dettach('#tooltipID3');\n<\/pre>\n<\/p>\n<h3>\u4ee3\u7801\u793a\u4f8b<\/h3>\n<p>\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u5c06\u521b\u5efa\u4e24\u4e2a\u4e0d\u540c\u7684Tip\u63d2\u4ef6\u5b9e\u4f8b\uff0c\u8fd9\u6837\u6211\u4eec\u5c31\u53ef\u4ee5\u6709\u4e24\u4e2a\u4e0d\u540c\u6837\u5f0f\u7684\u5de5\u5177\u63d0\u793a\u3002\u6211\u4eec\u8fd8\u5c06\u96c6\u6210\u6211\u4eec\u4e0a\u9762\u770b\u5230\u7684\u9009\u9879\u3001\u4e8b\u4ef6\u548c\u65b9\u6cd5\u3002<\/p>\n<p><pre lang=\"javascript\">\nvar customTips = $$('.tooltip');\n \nvar toolTips = new Tips(customTips, {\n    \/\/ \u8fd9\u5c06\u8bbe\u7f6e\u5de5\u5177\u63d0\u793a\u663e\u793a\u7684\u5ef6\u8fdf\u65f6\u95f4\n    showDelay: 1000,    \/\/ \u9ed8\u8ba4\u662f100\n \n    \/\/ \u8fd9\u5c06\u8bbe\u7f6e\u5de5\u5177\u63d0\u793a\u9690\u85cf\u7684\u5ef6\u8fdf\u4e8b\u4ef6\n    hideDelay: 100,   \/\/ \u9ed8\u8ba4\u662f100\n \n    \/\/ \u8fd9\u5c06\u7ed9\u5de5\u5177\u63d0\u793a\u7684\u5bb9\u5668div\u6dfb\u52a0\u4e00\u4e2aCSS\u6837\u5f0f\n    \/\/ \u8fd9\u6837\u5c31\u53ef\u4ee5\u5728\u4e00\u4e2a\u9875\u9762\u4e0a\n    \/\/ \u6709\u4e24\u4e2a\u4e0d\u540c\u6837\u5f0f\u7684\u5de5\u5177\u6761\u63d0\u793a\n    className: 'anything', \/\/ \u9ed8\u8ba4\u662fnull\n \n    \/\/ \u8fd9\u5c06\u8bbe\u7f6ex\u548cy\u7684\u504f\u79fb\u503c\n    offsets: {\n        'x': 100,       \/\/ \u9ed8\u8ba4\u662f16\n        'y': 16        \/\/ \u9ed8\u8ba416\n    },\n \n    \/\/ \u8fd9\u5c06\u8bbe\u7f6e\u5de5\u5177\u63d0\u793a\u662f\u5426\u8ddf\u968f\u9f20\u6807\n    \/\/ \u8bbe\u4e3atrue\u5c06\u4e0d\u4f1a\u8ddf\u968f\u9f20\u6807\n     fixed: false,      \/\/ \u9ed8\u8ba4\u662ffalse\n \n    \/\/ \u5982\u679c\u4f60\u5728\u9009\u9879\u4e4b\u5916\u8c03\u7528\u8fd9\u4e2a\u51fd\u6570\n    \/\/ \u5e76\u628a\u8fd9\u4e2a\u51fd\u6570\u7559\u5728\u8fd9\u91cc\n    \/\/ \u5b83\u5c31\u95ea\u4e00\u4e0b\uff0c\u5e76\u6709\u4e00\u4e2a\u5e73\u6ed1\u7684\u6e10\u53d8\u6548\u679c\n    onShow: function(toolTipElement){\n        \/\/ \u4f20\u9012\u8fdb\u6765tooltip\u5bf9\u8c61\n        \/\/ \u4f60\u53ef\u4ee5\u8ba9\u5b83\u4eec\u6e10\u53d8\u5230\u5b8c\u5168\u4e0d\u900f\u660e\n        \/\/ \u6216\u8005\u8ba9\u5b83\u4eec\u6709\u4e00\u70b9\u70b9\u900f\u660e\n        toolTipElement.fade(.8);\n        $('show').highlight('#FFF504');\n    },\n    onHide: function(toolTipElement){\n        toolTipElement.fade(0);\n        $('hide').highlight('#FFF504');\n    }\n});\n \nvar toolTipsTwo = new Tips('.tooltip2', {\n    className: 'something_else', \/\/ \u9ed8\u8ba4\u662fnull\n});\n \n\/\/ \u4f60\u53ef\u4ee5\u7528.store();\u65b9\u6cd5\u6765\u6539\u53d8rel\u7684\u503c\n\/\/ \u4ece\u800c\u6539\u53d8\u5de5\u5177\u63d0\u793a\u7684\u503c\n\/\/ \u4f60\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u4ee3\u7801\n$('tooltipID1').store('tip:text', 'You can replace the href with whatever text you want.');\n$('tooltipID1').store('tip:title', 'Here is a new title.');\n \n\/\/ \u4e0b\u9762\u7684\u4ee3\u7801\u5c06\u6539\u4e0d\u4f1a\u6539\u53d8\u5de5\u5177\u63d0\u793a\u7684\u6587\u672c\n$('tooltipID1').set('rel', 'This will not change the tooltips text');\n$('tooltipID1').set('title', 'This will not change the tooltips title');\n \ntoolTips.detach('#tooltipID2');\ntoolTips.detach('#tooltipID4');\ntoolTips.attach('#tooltipID4');\n<\/pre>\n<\/p>\n<p><div id=\"show\" class=\"ind\">onShow<\/div>\n<div id=\"hide\" class=\"ind\">onHide<\/div>\n<p>\n<a id=\"tooltipID1\" class=\"tooltip\" title=\"1st Tooltip Title\" rel=\"here is the default 'text' of 1\" href=\"http:\/\/www.consideropen.com\">Tool tip 1<\/a><\/p>\n<p><a id=\"tooltipID2\" class=\"tooltip\" title=\"2nd Tooltip Title\" rel=\"here is the default 'text' of 2\" href=\"http:\/\/www.consideropen.com\/blog\">Tool tip is detached<\/a><\/p>\n<p><a id=\"tooltipID3\" class=\"tooltip\" title=\"3rd Tooltip Title\" rel=\"here is the default 'text' of 3\" href=\"http:\/\/www.consideropen.com\/contact\">Tool tip 3<\/a><\/p>\n<p><a id=\"tooltipID4\" class=\"tooltip\" title=\"4rd Tooltip Title\" rel=\"here is the default 'text' of 4, i was detached then attached\" href=\"http:\/\/www.consideropen.com\/blog\/2008\/08\/30-days-of-mootools-12-tutorials-day-1-intro-to-the-library\/\">Tool tip detached then attached again. <\/a><\/p>\n<p><a id=\"tooltipID5\" class=\"tooltip2\" title=\"Other Tooltip Title\" rel=\"here is the default 'text' of 'other style'\" href=\"http:\/\/www.consideropen.com\">A differently styled tool tip<\/a><\/p>\n<\/p>\n<h3>\u66f4\u591a\u5b66\u4e60<\/h3>\n<p>\u901a\u8bfb\u4e00\u904dMooTools\u6587\u6863\u4e2d\u7684<a href=\"http:\/\/docs.mootools.net\/Plugins\/Tips\" target=\"_blank\" title=\"Tips\u8fd9\u4e00\u8282\">Tips\u8fd9\u4e00\u8282<\/a>\u3002\u53e6\u5916\uff0c\u8fd9\u91cc\u8fd8\u6709David Walsh\u5199\u7684\u4e00\u7bc7\u5f88\u4e0d\u9519\u7684\u5173\u4e8e<a href=\"http:\/\/davidwalsh.name\/mootools-12-tooltips-customize\" target=\"_blank\" title=\"\u5b9a\u5236Mootools Tips\">\u5b9a\u5236Mootools Tips<\/a>\u7684\u6587\u7ae0\u3002<\/p>\n<p><b><a href=\"http:\/\/www.consideropen.com\/downloads\/30days_of_moo\/mootorial_day19_tooltips.zip\" target=\"_blank\" title=\"\u4e0b\u8f7d\u4e00\u4e2a\u5305\u542b\u4f60\u6240\u9700\u8981\u7684\u5168\u90e8\u4e1c\u897f\u7684zip\u538b\u7f29\u5305\">\u4e0b\u8f7d\u4e00\u4e2a\u5305\u542b\u4f60\u6240\u9700\u8981\u7684\u5168\u90e8\u4e1c\u897f\u7684zip\u538b\u7f29\u5305<\/a><\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u539f\u6587\u5730\u5740\uff1a30 Days of Mootools 1.2 Tutorials &#8211; Day 19 &#8211; Tooltips Mootools 1.2\u5de5\u5177\u63d0\u793a\uff08tooltip\uff09\u6559\u7a0b \u8bf7\u5c0a\u91cd\u4e2a\u4eba\u52b3\u52a8\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\uff1ahttp:\/\/fdream.net\uff0c\u8bd1\u8005\uff1aFdream \u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u51c6\u5907\u597d\u5f00\u59cb\u8fd9\u4e00\u8bb2\uff0c\u8bf7\u53c2\u8003\u8fd9\u4e00\u7cfb\u5217\u7684\u6559\u7a0b\uff0c\u8fd9\u91cc\u662f\u300aMooTools 1.2\u7cfb\u5217\u6559\u7a0b\u76ee\u5f55\u300b\u3002 \u4eca\u5929\u6211\u4eec\u5c06\u6765\u770b\u4e00\u4e0bMooTools\u7ed1\u5b9a\u7684Tooltip\u63d2\u4ef6\u3002\u901a\u8fc7\u201c\u63d0\u793a\uff08Tips\uff09\u201d\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u5730\u81ea\u5b9a\u4e49\u4e00\u4e2a\u5305\u542b\u4e00\u4e2a\u6807\u9898\u548c\u5185\u5bb9\u7684\u5de5\u5177\u63d0\u793a\uff0c\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6837\u5f0f\uff0c\u81ea\u5b9a\u4e49\u6de1\u5165\u6de1\u51fa\u6e10\u53d8\u6548\u679c\u3002\u6211\u4eec\u8fd8\u5c06\u4ed4\u7ec6\u5b66\u4e60\u4e00\u4e0b\u5de5\u5177\u63d0\u793a\u7684\u9009\u9879\u548c\u4e8b\u4ef6\uff0c\u8fd8\u6709\u4e00\u4e9b\u7528\u6765\u4ece\u5143\u7d20\u4e0a\u6dfb\u52a0\u548c\u79fb\u9664\u5de5\u5177\u63d0\u793a\u7684\u5de5\u5177\u3002\u6700\u540e\uff0c\u6211\u4eec\u5c06\u5b66\u4e60\u4e00\u4e0b\u600e\u4e48\u8ba9\u4e00\u4e2a\u9875\u9762\u6709\u591a\u4e2a\u4e0d\u540c\u6837\u5f0f\u7684\u5de5\u5177\u63d0\u793a\u3002 \u57fa\u7840\u77e5\u8bc6 \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5de5\u5177\u63d0\u793a \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u5de5\u5177\u63d0\u793a\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\uff0c\u6211\u4eec\u6765\u521b\u5efa\u4e00\u4e2a\u8981\u6dfb\u52a0\u5de5\u5177\u63d0\u793a\u7684\u94fe\u63a5\uff1a &lt;a class=&quot;tooltipA&quot; title=&quot;1st Tooltip Title&quot; rel=&quot;here is the default &#8216;text&#8217; of 1&quot; href=&quot;http:\/\/www.consideropen.com&quot;&gt;Tool tip 1&lt;\/a&gt; MooTools 1.2\u5de5\u5177\u63d0\u793a\u5c06\u9ed8\u8ba4\u663e\u793a\u94fe\u63a5\u4e2d\u7684title\u548crel\u5c5e\u6027\u7684\u503c\u3002\u5982\u679c\u6ca1\u6709rel\u5c5e\u6027\uff0c\u5c06\u663e\u793ahref\u5c5e\u6027\u503c\u3002 \u73b0\u5728\u6765\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u9ed8\u8ba4\u5de5\u5177\u6761\u63d0\u793a\uff1a var customTips = $$(&#8216;.tooltipA&#8217;); var toolTips = new Tips(customTips); \u7531\u4e8e\u6ca1\u6709\u4f7f\u7528\u4efb\u4f55\u6837\u5f0f\uff0c\u4f60\u5c06\u770b\u5230\u4e0b\u9762\u8fd9\u6837\u7684\u5de5\u5177\u63d0\u793a\uff1a Tool tip 1 \u4e3a\u4f60\u7684\u5de5\u5177\u63d0\u793a\u4f7f\u7528\u6837\u5f0f MooTools\u53ef\u4ee5\u8ba9\u4f60\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u63a7\u5236\u5b83\u7684\u8f93\u51fa\u2014\u2014\u6211\u4eec\u6765\u770b\u4e00\u4e0b\u5de5\u5177\u63d0\u793a\u7684html\u4ee3\u7801\uff1a \/\/ \u4f60\u53ef\u4ee5\u5728options\u4e2d\u6307\u5b9a &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[120,104,328,123],"class_list":["post-642","post","type-post","status-publish","format-standard","hentry","category-coding","tag-AJAX","tag-JavaScript","tag-mootools","tag-123"],"views":13742,"_links":{"self":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/comments?post=642"}],"version-history":[{"count":0,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/posts\/642\/revisions"}],"wp:attachment":[{"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/media?parent=642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/categories?post=642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fdream.net\/blog\/wp-json\/wp\/v2\/tags?post=642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}