多行文本超出 JS省略号...
来源:互联网 发布:使用u盘安装linux系统 编辑:程序博客网 时间:2024/05/21 01:32
(function($) { $(".first-button").on("click", function(event){ $(".first-text").ellipsis(200); $(this).hide(); });})(jQuery);
(function($) { $.fn.ellipsis = function(charCount) { return $(this).each(function() { var el = $(this); var originalText = el.html(); var originalTextLength = originalText.length; var tempNode = $(this.cloneNode(true)); var min = 0; var max = charCount; if(charCount < originalTextLength){ if (min<=max){ var tooltipHTML = null; var trimLocation = (min + max); var text = originalText.substr(0, trimLocation); tempNode.html(text + "…"); tooltipHTML = '<span style="position:relative"><span class="ellipsis-tooltip-theme ellipsis-tooltip" style="margin-top:0.3%">'+originalText+'<span class="ellipsis-tooltip-nub"></span></span ></span >'; el.after(tooltipHTML); } if (min > max) { //If the max value is greater than the min value, just raise a warning. console.log('character count has to be greater than 0.'); } } else { return false; } el.html(tempNode.html()); tempNode.remove(); el.mouseenter(function(){ el.parent().find('.ellipsis-tooltip').fadeIn(500); }); el.mouseleave(function(){ el.parent().find('.ellipsis-tooltip').fadeOut(500); }); }); };})(jQuery);
0 0
- 多行文本超出 JS省略号...
- 多行文本超出时显示省略号----jquery.ellipsis.js
- 多行文本超出部分省略号代替
- 关于单行、多行文本超出显示省略号... css
- 一行或多行文本超出区域用省略号表示
- 多行文本超出用省略号代替,单击展开全部
- 设置多行文本超出显示省略号,在手机端超出部分无法隐藏解决方法
- 多行文本溢出省略号
- 多行文本显示省略号
- 多行文字 超出显示省略号
- 多行文字超出部分显示省略号
- web 多行文字超出显示省略号
- 单行文本与多行文本超出范围需要隐藏并显示省略号
- ellipsis单行文本和-webkit-box多行文本超出部分显示省略号
- 多行文本溢出显示省略号...
- 多行文本溢出显示省略号…
- css3 多行文本 溢出 省略号
- WebKit多行文本溢出显示省略号(...)
- 【练习题】读取一个字符串,计算每个字母出现的个数
- Median of Two Sorted Arrays - LeetCode 4
- 练习代码(三)复用类
- hdu 1385 Minimum Transport Cost (Floyd 路径输出)
- 脚本无阻塞加载
- 多行文本超出 JS省略号...
- java中多线程的基本理解以及运行机制
- 黑马程序员——java基础——GUI
- Jackson 使用遇到 Unrecognized field, not marked as ignorable
- 关于wikibook上的singleton的疑问
- Struts2不进action就跳到Input配置的页面
- iOS开发使用.ttf或.otf外部字体库
- 浙江大学PAT_甲级_1065. A+B and C (64bit) (20)
- 判断一个类名或者元素是否存在的思路