简体   繁体   English

…在加速的移动页面(AMP)上显示更多

[英]…Show More on Accelerated Mobile Pages (AMP)

I am creating an amp for my webpage. 我正在为我的网页创建一个放大器。 It contains lot of description about places. 它包含有关地点的大量描述。 I want to implement ..show more after 4 lines so that user can see other content also in the mobile first fold (Text is dynamic so can be less than 4 lines also. In that case how can i determine that show more will not come) Is this possible with AMP?? 我想在4行之后实施..show more ,以便用户可以在移动设备的第一折中看到其他内容(文本是动态的,因此也可以少于4行。在那种情况下,我如何确定不会显示更多内容)使用AMP可以吗? Since I cannot use javascript and css solution is not possible for this, please help me in finding alternatives for the same. 由于我无法使用JavaScript,因此无法使用CSS解决方案,因此请帮助我寻找相同的替代方案。 I have searched a lot about this but no luck so far. 我对此进行了很多搜索,但到目前为止还没有运气。 Thanks in advance 提前致谢

You can use an amp-accordion for this: 您可以为此使用amp手风琴:

<p>The first four lines...</p>  
<amp-accordion disable-session-states>
  <section>
    <h4>
      <span class="show-more">Show more</span>
    </h4>
    <p>The remaining text... </p>
  </section>
</amp-accordion>

Here is a working example. 是一个工作示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM