{"id":656906,"date":"2021-09-10T22:16:49","date_gmt":"2021-09-11T01:16:49","guid":{"rendered":"https:\/\/xptt.com\/?p=656906"},"modified":"2021-09-10T22:19:25","modified_gmt":"2021-09-11T01:19:25","slug":"jquery-%e7%82%b9%e5%87%bb%e6%8c%89%e9%92%ae-1-%e6%95%88%e6%9e%9c","status":"publish","type":"post","link":"https:\/\/xptt.com\/656906.html","title":{"rendered":"jQuery \u70b9\u51fb\u6309\u94ae +1 \u6548\u679c"},"content":{"rendered":"<p>\u524d\u6bb5\u65f6\u95f4\u5728\u4f18\u5316\u8d2d\u7269\u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u60f3\u5b9e\u73b0\u70b9\u51fb\u6309\u94ae\u52a0\u4e00\u7684\u6548\u679c\uff0c\u6bd4\u5982\u70b9\u51fb\u52a0\u5165\u8d2d\u7269\u8f66\u56fe\u6807\u540e\u6709+1\u7684\u6548\u679c\uff0c\u7c7b\u4f3c\u70b9\u8d5e+1\u6548\u679c\uff0c\u5728\u8fd9\u91cc\u8bb0\u5f55\u4e00\u4e0b\u3002<\/p>\n<p>\u6548\u679c\u5c55\u793a\uff1a<a href=\"http:\/\/lankeonline.com\" target=\"_blank\" rel=\"noopener noreferrer\">\u70b9\u8fd9\u91cc\u8fdb\u5165\uff0c\u70b9\u51fb\u5546\u54c1\u65c1\u8fb9\u7684\u6dfb\u52a0\u5230\u8d2d\u7269\u8f66\u6309\u94ae\u3002<\/a><\/p>\n<p>\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<blockquote><p>&lt;script type=\"text\/javascript\"&gt;<br \/>\n(function ($) {<br \/>\n$.extend({<br \/>\ntipsBox: function (options) {<br \/>\noptions = $.extend({<br \/>\nobj: null, \/\/jq\u5bf9\u8c61\uff0c\u8981\u5728\u90a3\u4e2ahtml\u6807\u7b7e\u4e0a\u663e\u793a<br \/>\nstr: \"+1\", \/\/\u5b57\u7b26\u4e32\uff0c\u8981\u663e\u793a\u7684\u5185\u5bb9;\u4e5f\u53ef\u4ee5\u4f20\u4e00\u6bb5html\uff0c\u5982: \"&lt;b style='font-family:Microsoft YaHei;'&gt;+1&lt;\/b&gt;\"<br \/>\nstartSize: \"12px\", \/\/\u52a8\u753b\u5f00\u59cb\u7684\u6587\u5b57\u5927\u5c0f<br \/>\nendSize: \"30px\", \/\/\u52a8\u753b\u7ed3\u675f\u7684\u6587\u5b57\u5927\u5c0f<br \/>\ninterval: 600, \/\/\u52a8\u753b\u65f6\u95f4\u95f4\u9694<br \/>\ncolor: \"red\", \/\/\u6587\u5b57\u989c\u8272<br \/>\ncallback: function () { } \/\/\u56de\u8c03\u51fd\u6570<br \/>\n}, options);<br \/>\n$(\"body\").append(\"&lt;span class='num'&gt;\" + options.str + \"&lt;\/span&gt;\");<br \/>\nvar box = $(\".num\");<br \/>\nvar left = options.obj.offset().left + options.obj.width() \/ 2;<br \/>\nvar top = options.obj.offset().top - options.obj.height();<br \/>\nbox.css({<br \/>\n\"position\": \"absolute\",<br \/>\n\"left\": left + \"px\",<br \/>\n\"top\": top + \"px\",<br \/>\n\"z-index\": 9999,<br \/>\n\"font-size\": options.startSize,<br \/>\n\"line-height\": options.endSize,<br \/>\n\"color\": options.color<br \/>\n});<br \/>\nbox.animate({<br \/>\n\"font-size\": options.endSize,<br \/>\n\"opacity\": \"0\",<br \/>\n\"top\": top - parseInt(options.endSize) + \"px\"<br \/>\n}, options.interval, function () {<br \/>\nbox.remove();<br \/>\noptions.callback();<br \/>\n});<br \/>\n}<br \/>\n});<br \/>\n})(jQuery);<\/p>\n<p>function niceIn(prop){<br \/>\nprop.find('i').addClass('niceIn');<br \/>\nsetTimeout(function(){<br \/>\nprop.find('i').removeClass('niceIn');<br \/>\n},1000);<br \/>\n}<br \/>\n$(function () {<br \/>\n$(\"#btn\").click(function () {<br \/>\n$.tipsBox({<br \/>\nobj: $(this),<br \/>\nstr: \"+1\",<br \/>\ncallback: function () {<br \/>\n}<br \/>\n});<br \/>\nniceIn($(this));<br \/>\n});<br \/>\n});<br \/>\n&lt;\/script&gt;<\/p><\/blockquote>\n<p>\u5f53\u7136\uff0c\u4ee5\u4e0a\u4ee3\u7801\u4e5f\u53ef\u4ee5\u628a+1\u6362\u6210\u5176\u4ed6\u7b26\u53f7\uff0c\u6bd4\u5982\u6253\u94a9\uff1a\u221a \uff0c\u6bd4\u5982\u8fd8\u662f\u521a\u624d\u90a3\u4e2a\u8d2d\u7269\u7f51\u7ad9\uff0c\u8fdb\u5165\u4ea7\u54c1\u8be6\u7ec6\u9875\u9762\uff0c\u70b9\u51fb\u8d2d\u4e70\u7684\u65f6\u5019\uff0c\u7f51\u9875\u6ca1\u6709\u4ec0\u4e48\u53cd\u5e94\uff0c\u56e0\u4e3a\u7528\u4e86\u65e0\u5237\u65b0\u529f\u80fd\uff0c\u4e8e\u662f\u7ed9\u6309\u94ae\u4e5f\u52a0\u4e0a\u4e86\u70b9\u51fb\u540e\u663e\u793a\u6253\u94a9\u221a\uff0c\u6548\u679c\u4e5f\u4e0d\u9519\u3002<\/p>\n<p>\u597d\u4e86\uff0c\u6700\u8fd1\u6709\u70b9\u5fd9\uff0c\u4e00\u6298\u817e\u7f51\u7ad9\uff0c\u5c31\u6709\u70b9\u5174\u594b\uff0c\u54c8\u54c8\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u6bb5\u65f6\u95f4\u5728\u4f18\u5316\u8d2d\u7269\u7f51\u7ad9\u7684\u65f6\u5019\uff0c\u60f3\u5b9e\u73b0\u70b9\u51fb\u6309\u94ae\u52a0\u4e00\u7684\u6548\u679c\uff0c\u6bd4\u5982\u70b9\u51fb\u52a0\u5165\u8d2d\u7269\u8f66\u56fe\u6807\u540e\u6709+1\u7684\u6548\u679c\uff0c\u7c7b\u4f3c\u70b9\u8d5e+1\u6548\u679c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[425,1940,2134,2135],"views":8727,"_links":{"self":[{"href":"https:\/\/xptt.com\/wp-json\/wp\/v2\/posts\/656906"}],"collection":[{"href":"https:\/\/xptt.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xptt.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xptt.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xptt.com\/wp-json\/wp\/v2\/comments?post=656906"}],"version-history":[{"count":0,"href":"https:\/\/xptt.com\/wp-json\/wp\/v2\/posts\/656906\/revisions"}],"wp:attachment":[{"href":"https:\/\/xptt.com\/wp-json\/wp\/v2\/media?parent=656906"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xptt.com\/wp-json\/wp\/v2\/categories?post=656906"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xptt.com\/wp-json\/wp\/v2\/tags?post=656906"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}