简体   繁体   English

添加查看更多按钮

[英]Add view more button

I have this section created by bootstrap SQLserver and php... 我有由引导SQLserver和php创建的本节...

Is there any way to display just a little of it and give the view more button option to display the whole result? 有什么办法可以只显示其中一部分,并提供“查看更多”按钮选项以显示整个结果?

在此处输入图片说明

There are like 10 Decks, and I want eg to sidplay just 2 and when user clicks View More to display all of them. 大约有10个甲板,我想例如仅对sidplay 2个进行播放,当用户单击“查看更多”以显示所有它们时。

This is my php code for that result. 这是我针对该结果的php代码。

<div class="vertical-wrapper">
<?php 
for($i=0;$i<count($decks);$i++){
   $deck_name = $decks[$i]['name'];
   $deck_desc = $decks[$i]['description'];                                        
   $deck_img_link = $json['deckplans'][$i]['images'][0]['href'];
  echo "<img class='bd-imagelink-157 bd-own-margins bd-imagestyles' src='$deck_img_link'><p class='bd-textblock-779 bd-content-element'>$deck_name</p>";
   echo $deck_desc;
 }
?>
</div>

I tried to put the bootstrap add more button but is displayed in the end of the section,after all content is loaded, and is pointless 我试图将bootstrap添加更多按钮,但在所有内容加载之后显示在本节的末尾,并且毫无意义

The following example demonstrates how you might reveal additional hidden items one at a time. 下面的示例演示如何一次显示一个额外的隐藏项目。 You will need to use the jQuery JavaScript library for this to work. 您将需要使用jQuery JavaScript库才能工作。

 $('#viewmore').on('click', function(){ $('.item:hidden').show(); }) 
 .hidden { display: none; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="item"> ITEM 1 </div> <div class="item hidden"> ITEM 2 </div> <div class="item hidden"> ITEM 3 </div> <div class="item hidden"> ITEM 4 </div> <button id="viewmore"> View More </button> </button> 

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

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