html 单击readmore 无效,如何在html中创建只需要锚点的see-more/Read-more功能?

本文介绍如何为不熟悉技术的用户创建一个基于jQuery的'查看更多'功能,使得网页内容能通过点击向上/向下滚动显示。通过添加锚点,实现多处内容的展开和收起,简化了代码维护。主要涉及HTML结构和jQuery事件监听。
摘要由CSDN通过智能技术生成

我正在做一个网站,由不那么科技精明的人来维护,我需要能够给他们添加使用jquery向上/向下滑动以显示其内容的“see-more”锚点的能力。如何在html中创建只需要锚点的see-more/Read-more功能?

我的代码适用于读取更多的单个实例,但是当存在多个此实例时,它会相当麻烦。

使用Javascript/jQuery的

$(".see-more").nextUntil(".see-less").wrapAll("

$(".see-less").hide();

var count= 1

/*

$(".see-more-content").each(function(){

var count= count+1;

$(this).data("count",count);

console.log(count);

});

*/

$(".see-more-content").slideUp(0);

$(".see-more").click(function(){

$(".see-more-content").slideToggle();

$(".see-more").hide();

$(".see-less").show();

});

$(".see-less").click(function(){

$(".see-more-content").slideToggle();

$(".see-less").hide();

$(".see-more").show();

});

HTML

See More...

  • Advanced Elastic search Technology
  • Document Text Search
  • Embed Code Web Publishing for Images, Video & PDFs
  • Video Management with HTML5 Full
  • Previews On the Fly Conversions and Transcoding
  • Print on Demand
  • Stylized Collections (Lightboxes/Galleries)
  • Alerts and Notifications
  • Comments, Ratings and Favorites
  • WordPress and Drupal CMS Integrations
  • Dropbox Integration
  • Asset Level Performance Analytics • Site Activity Analytics Dashboard
  • Unlimited Custom User Access Levels
  • Integrated Content Contribution and Workflow
  • Personal Profile Management
  • Mobile App and Site 
  • Watermarking
  • Rights Management
  • All New Feature Releases3

See Less...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值