jquery 点击显示更多
点击显示更多
html
<div class="servicepicture banxin">
<div class="imgcontent">
<div class="img">
<img src="/uploads/image/20190411/d5ec13bdf0fcb9eaa8cf265d94fe6035.png" />
</div>
<div class="topic">在施工结束后公司将定期回访甲方装置的运行情况,反应器的温差情况,提供后续服务支持(包括催化剂撇头,部分更换等),确保甲方装置运行良好。公司配备24小时值守响应机制,随时随刻为客户解决因催化剂造成的突发问题。</div>
<div class="check">查看更多</div>
</div>
<div class="imgcontent">
<div class="img">
<img src="/uploads/image/20190411/0aaf7bd140beefad5316ffb07ede779c.png" />
</div>
<div class="topic">在施工结束后公司将定期回访甲方装置的运行情况,反应器的温差情况,提供后续服务支持(包括催化剂撇头,部分更换等),确保甲方装置运行良好。公司配备24小时值守响应机制,随时随刻为客户解决因催化剂造成的突发问题。</div>
<div class="check">查看更多</div>
</div>
<div class="imgcontent">
<div class="img">
<img src="/uploads/image/20190411/d5ec13bdf0fcb9eaa8cf265d94fe6035.png" />
</div>
<div class="topic">在施工结束后公司将定期回访甲方装置的运行情况,反应器的温差情况,提供后续服务支持(包括催化剂撇头,部分更换等),确保甲方装置运行良好。公司配备24小时值守响应机制,随时随刻为客户解决因催化剂造成的突发问题。</div>
<div class="check">查看更多</div>
</div>
</div>
css
.servicepicture {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
overflow: hidden;
margin-top: 40px;
}
.banxin{
width:1200px;
margin:0 auto;
}
.imgcontent {
width: 375px;
margin: 10px 12.5px;
}
.imgcontent .img {
width: 375px;
height: 280px;
margin: 0 auto;
overflow: hidden;
}
.imgcontent .img img {
width: 375px;
height: 280px;
}
.imgcontent .topic {
width: 375px;
margin: 0 auto;
font-size: 14px;
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
}
.check {
width: 100px;
height: 40px;
margin: 0 auto;
background: #A9010A;
color: #FFFFFF;
text-align: center;
line-height: 40px;
border-radius: 5px;
margin-top: 30px;
}
var arr = [];
var show = true;
function subTxt() {
$('.servicepicture .imgcontent .topic').each(function(index) {
var len = $(this).text().length; var that = $(this);
var oldTxt = $(this).text();
arr.push(oldTxt);
var txt = $(this).text().substr(0, 30) + '...'; $(this).text(txt) }) }
subTxt();
$(".servicepicture .imgcontent .check").each(function(index) { $(this).click(function() {
console.log(index);
if(!show){
subTxt();
show = !show;
}else{
$('.servicepicture .imgcontent .topic').eq(index).text(arr[index]);
show = !show;
}
}) })
jquery 点击显示更多的更多相关文章
- jQuery 点击显示再次点击隐藏
<html> <head> <script type="text/javascript" src="/jquery/jquery.js&qu ...
- 锋利的Jquery(点击显示隐藏div)
点击显示隐藏div <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://w ...
- jquery 点击查看更多箭头变化,文字变化,超出带滚动条。
从网上好了好久,没找到自己要的,自己写了一下. <!DOCTYPE html> <html> <head> <meta charset="utf-8 ...
- jquery点击显示或隐藏
点击第一个dd,给第一li添加class,点击第二个dd,给第二个li添加class,以此类推 $(function(){ $("dd > a").click(fun ...
- Android编程之仿微信显示更多文字的View
微信朋友圈中,如果好友发表的文字过长,会自动收缩起来,底下有提示,当点击“显示更多”时才会展开. 首先定义布局文件(很简单,不解释): <?xml version="1.0" ...
- js点击更多显示更多内容效果
我写了一个简单的分段显示插件,用法很简单:1,把你要分面显示的内容的容器元素增加一个class=showMoreNChildren,并增加一个自定义属性pagesize="8" 这 ...
- 【代码笔记】iOS-点击城市中的tableView跳转到旅游景点的tableView,下面会有“显示”更多。
一,效果图. 二,工程图. 三,代码. RootViewController.h #import <UIKit/UIKit.h> @interface RootViewController ...
- jquery点击改变class并toggle;jquery点击改变图片src源码并toggle;jquery显示隐藏toggle
<html><head><meta charset="utf-8"><title></title><script ...
- 基于Jquery UI的autocompelet改写,自动补全控件,增加下拉选项,动态设置样式,点击显示所有选项,并兼容ie6+
Jquery UI的autocompelete改写 注意:实现功能,除了原版的自动补全内容外,增加一个点击显示所有选项,样式能动态设置. 加载数据的来源为后台数据库读取. 具体代码如下: 引用 从官方 ...
随机推荐
- windows ip路由
windows 20082块网卡,连接远程mysql数据库一直不通,ping正常,telnet 3306端口不正常 route print 路由情况 route add 10.255.2574.XXX ...
- SpringBoot整合Apache Shiro权限验证框架
比较常见的权限框架有两种,一种是Spring Security,另一种是Apache Shiro,两种框架各有优劣,个人感觉Shiro更容易使用,更加灵活,也更符合RABC规则,而且是java官方更推 ...
- Instrumentation接口详解
Instrumentation接口位于jdk1.6包java.lang.instrument包下,Instrumentation指的是可以独立于应用程序之外的代理程序,可以用来监控和扩展JVM上运行的 ...
- 遍历tr通过name获取对应值用作判断或者赋值
$("#table tr:gt(0)").each(function(i){ var bidPrice = $("input[name='bidPrice2s']&quo ...
- springboot+mybatis环境的坑和sql语句简化技巧
1.springfox-swagger实体类无限递归 https://hacpai.com/article/1525674135818 里面有不完美的解决方案 不用动源码的解决方案也有,在swagge ...
- postgres跨平台开发坑之空值
ngx_lua架构下查询linux版postgres时,如果目标字段的值返回空,则返回结果为 ngx.null,同样的代码如果查询windows版postgres时,如果目标字段的值返回空,则返回结果 ...
- etcd 启动错误
Apr 26 16:17:25 ceph-0 etcd: f281dc69fb4dd3d8 became candidate at term 3574Apr 26 16:17:25 ceph-0 et ...
- IDEA 发布Api
1.修改Main方法 代码: public class AlicsbapiApplication extends SpringBootServletInitializer { @Override pr ...
- Summary on deep learning framework --- PyTorch
Summary on deep learning framework --- PyTorch Updated on 2018-07-22 21:25:42 import osos.environ[ ...
- Java后台判断是否是ajax请求,并进行处理
Java过滤器处理Ajax请求,Java拦截器处理Ajax请求,拦截器Ajax请求 >>>>>>>>>>>>>>&g ...