日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

封装 oschina.net 表情选择

發布時間:2023/12/13 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 封装 oschina.net 表情选择 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1. [代碼]jquery.facial.js ? ??

//從OSCHINA.NET 提取出來的 表情選擇 插件 by zhouxiang?
//如果有不滿足的地方 可以自己改改 沒事隨便寫寫的 style 和 html 都被我弄到JS里了 這樣方便簡潔
jQuery.fn.extend({
? ? facial: function (opts) {
? ? ? ? var _self = this, _this = $(this);
? ? ? ? opts = jQuery.extend({
? ? ? ? ? ? CallBack: function (i) { }
? ? ? ? }, opts || {});
? ? ? ? _self.Resource = {
? ? ? ? ? ? Style: "<style>#TweetFormPopupWraper{padding: 0;margin: 0;font-size: 9pt;font-family: 微軟雅黑,Verdana,sans-serif,宋體;position: absolute;z-index: 9999;margin: 5px 0 0 0;}#TweetFormPopupWraper .clear{clear: both;font-size: 1px;line-height: 0;}#TweetFormPopupWraper ol, ul{list-style: none;padding: 0;margin: 0;}#TweetFormPopupWraper #TweetFormPopup .TweetPopupTitle{padding: 3px 5px;margin: 0 0 10px 0;font-weight: bold;line-height: 30px;border-bottom: 1px solid #EEE;font-size: 14px;}#TweetFormPopupWraper #TweetFormPopup .TweetPopupTitle a{float: right;text-decoration: none;}#TweetFormPopupWraper #TweetFormPopupWraper .l{margin: 0 0 10px 0;}#TweetFormPopupWraper #TweetFormPopupArrow{background-image: url('http://city.oschina.net/img/space/up_arrow.gif');background-repeat: no-repeat;padding-top: 5px;}#TweetFormPopupWraper .tweet_emotion{background-position: 51px 0px;}#TweetFormPopupWraper .tweet_image{background-position: 102px 0px;}#TweetFormPopupWraper .tweet_video{background-position: 152px 0px;}#TweetFormPopupWraper #TweetFormPopup{width: 392px;border: 2px solid #CCC;background: #F8F7F7;padding: 5px;}#TweetFormPopupWraper #TweetFormPopup a.emotion_img{float: left;width: 24px;height: 24px;background-image: url('http://city.oschina.net/js/ke/plugins/emoticons/qq.gif');background-repeat: no-repeat;margin: 0 2px 4px 0;border: 1px solid #F6F6F6;}#TweetFormPopupWraper #TweetFormPopup a.emotion_img:hover{border: 1px solid #5CC26F;}</style>",
? ? ? ? ? ? Html: "<div id=\"TweetFormPopupWraper\" style=\"display:none\"><div id=\"TweetFormPopupArrow\" class=\"tweet_emotion\"><div id=\"TweetFormPopup\"><ul id=\"TweetFormUl\"><li><div id=\"TweetEmotions\"><div class=\"TweetPopupTitle\"><a href=\"javascript:;\">關閉</a>插入表情</div></div></li></ul><div class=\"clear\"></div></div></div></div>"
? ? ? ? };
? ? ? ? _self.AddFacial = function (i) {
? ? ? ? ? ? $("#TweetFormPopupWraper #TweetEmotions").append("<a href=\"javascript:;\" class=\"emotion_img\" style=\"background-position: -" + i + "px 0px;\"></a>");
?
? ? ? ? }
? ? ? ? _self.WH = function (obj) {
? ? ? ? ? ? var top = obj.offset().top + obj.height() + 10;
? ? ? ? ? ? var left = obj.offset().left - 35;
? ? ? ? ? ? $("#TweetFormPopupWraper").css({ left: left, top: top });
? ? ? ? }
? ? ? ? _self.PageLoad = function () {
? ? ? ? ? ? if ($("#TweetFormPopupWraper").length == 0) {
? ? ? ? ? ? ? ? $(document.body).append(_self.Resource.Style);
? ? ? ? ? ? ? ? $(document.body).append(_self.Resource.Html);
? ? ? ? ? ? ? ? for (var i = 0; i < 135; i++) {
? ? ? ? ? ? ? ? ? ? _self.AddFacial(i * 24);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? $("#TweetFormPopupWraper .TweetPopupTitle a").click(function () {
? ? ? ? ? ? ? ? ? ? $("#TweetFormPopupWraper").hide();
? ? ? ? ? ? ? ? });
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? _this.click(function () {
? ? ? ? ? ? $("#TweetFormPopupWraper #TweetEmotions a.emotion_img").unbind("click").click(function () {
? ? ? ? ? ? ? ? opts.CallBack($(this).index() - 1);
? ? ? ? ? ? });
? ? ? ? ? ? _self.WH($(this));
? ? ? ? ? ? $("#TweetFormPopupWraper").show();
? ? ? ? });
? ? ? ? _self.PageLoad();
? ? }
});
2. [代碼]demo.htm ? ??

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
? ? <title></title>
? ? <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
? ? <script src="jquery.facial.js" type="text/javascript"></script>
</head>http://www.huiyi8.com/gaoxiaodonghua/?
<body>美女
? ? <div >
? ? ? ? <input type="button" id="btn1" class="btn" value="open" />
? ? </div>
? ? <br />
? ? <br />
? ? <br />
? ? <br />
? ? <div >
? ? ? ? <input type="button" id="btn2" ?class="btn" value="open" />
? ? </div>
? ? <br />
? ? <br />
? ? <br />
? ? <br />
? ? <div >
? ? ? ? <input type="button" id="btn3" ?class="btn" value="open" />
? ? </div>
? ? <script>
? ? ? ? $(function () {
? ? ? ? ? ? //可以這樣 ?統一
// ? ? ? ? ? ?$(".btn").facial({ CallBack: function (i) {
// ? ? ? ? ? ? ? ?//點擊返回圖片索引,然后自己做處理
// ? ? ? ? ? ? ? ?alert(i);
// ? ? ? ? ? ?}
// ? ? ? ? ? ?});
? ? ? ? ? ? //也可以這樣 分開
? ? ? ? ? ? $("#btn1").facial({ CallBack: function (i) {
? ? ? ? ? ? ? ? //點擊返回圖片索引,然后自己做處理
? ? ? ? ? ? ? ? alert("第一個:"+i);
? ? ? ? ? ? }
? ? ? ? ? ? });
? ? ? ? ? ? $("#btn2").facial({ CallBack: function (i) {
? ? ? ? ? ? ? ? //點擊返回圖片索引,然后自己做處理
? ? ? ? ? ? ? ? alert("第二個:" + i);
? ? ? ? ? ? }
? ? ? ? ? ? });
? ? ? ? ? ? $("#btn3").facial({ CallBack: function (i) {
? ? ? ? ? ? ? ? //點擊返回圖片索引,然后自己做處理
? ? ? ? ? ? ? ? alert("第三個:" + i);
? ? ? ? ? ? }
? ? ? ? ? ? });
? ? ? ? });
? ? </script>
</body>
</html>

轉載于:https://www.cnblogs.com/xkzy/p/3966665.html

總結

以上是生活随笔為你收集整理的封装 oschina.net 表情选择的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。