首页 > 代码库 > 文本省略号

文本省略号

1.文本省略号

技术分享
<!DOCTYPE html><html><head lang="en">    <meta charset="UTF-8">    <title></title></head><body><script src="http://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script><script>    $(function () {        function sucstr(name,num,a){            var clientw = $(document.body).width();            var pur_span_text = $(name).text();            if(clientw<375){                pur_span_text = pur_span_text.substr(0,num)+...;            }            else if(clientw>=375&&clientw<=410){                num=num+a;                pur_span_text = pur_span_text.substr(0,num)+...;            }            else if(clientw>=410&&clientw<=500){                num=num+a+a;                pur_span_text = pur_span_text.substr(0,num)+...;            }            else{            }            $(name).text(pur_span_text);        }        sucstr(.weui_media_title,12,3);    });</script><div class="weui_media_title">    123232142412</div></body></html>
View Code

 2.文本居中

技术分享

3.禁用UC浏览器左右滑动切换页面

技术分享
//禁用uc浏览器左右滑动切换页面问题(function(){var control = navigator.control || {};if(control.gesture){control.gesture(false);}})();
View Code

 

文本省略号