我有一个引导滑块,显示最近的帖子,我想要得到3个帖子的标题和图像,并把他们放在img scr和p中,我想把每个项目单独带来,以便能够把它放在代码里面
<div class='flex-grow widget-inner'>
<div class='carousel slide' data-bs-ride='carousel' id='carouselExampleCaptions'>
<div class='carousel-indicators'>
<button aria-current='true' aria-label='Slide 1' class='active' data-bs-slide-to='0' data-bs-target='#carouselExampleCaptions' type='button'/>
<button aria-label='Slide 2' data-bs-slide-to='1' data-bs-target='#carouselExampleCaptions' type='button'/>
<button aria-label='Slide 3' data-bs-slide-to='2' data-bs-target='#carouselExampleCaptions' type='button'/>
</div>
<div class='carousel-inner'>
<div class='carousel-item active'>
<img alt='...' class='d-block w-100' src='https://1.bp.blogspot.com/-qq6KbFXzexw/YHoA4BaCfBI/AAAAAAAAF-8/o93DIHz4xa4zMMyYfmX_hDEDrUUardirwCLcBGAsYHQ/s16000/%25D9%2585%25D8%25A8%25D8%25A7%25D8%25B1%25D8%25A7%25D8%25A9%2B%25D8%25A7%25D9%2584%25D8%25A3%25D9%2587%25D9%2584%25D9%2589%2B%25D9%2588%25D8%25A7%25D9%2584%25D8%25B2%25D9%2585%25D8%25A7%25D9%2584%25D9%2583%2B18-4-2021.webp'/>
<div class='carousel-caption d-none d-md-block'>
<h5>First slide label</h5>
<p>Some representative placeholder content for the first slide.</p>
</div>
</div>
<div class='carousel-item'>
<img alt='...' class='d-block w-100' src='https://1.bp.blogspot.com/-vYM4UIdLty4/YHnxtDr8IcI/AAAAAAAAF-0/1JR8EZpgtIEyRlW7sffau6ost0dVJWlaQCLcBGAsYHQ/s16000/%25D8%25A8%25D8%25AB%2B%25D9%2585%25D8%25A8%25D8%25A7%25D8%25B4%25D8%25B1%2B%25D8%25A8%25D8%25B1%25D8%25B4%25D9%2584%25D9%2588%25D9%2586%25D8%25A9%2B%25D9%2588%25D8%25A7%25D8%25AA%25D9%2584%25D8%25AA%25D9%258A%25D9%2583%2B%25D8%25A8%25D9%2584%25D8%25A8%25D8%25A7%25D9%2588%2B%2B%25D8%25A8%25D8%25AF%25D9%2588%25D9%2586%2B%25D8%25AA%25D9%2582%25D8%25B7%25D9%258A%25D8%25B9%2B%2B%25D8%25A7%25D9%2584%25D8%25A7%25D9%2586.webp'/>
<div class='carousel-caption d-none d-md-block'>
<h5>Second slide label</h5>
<p>Some representative placeholder content for the second slide.</p>
</div>
</div>
<div class='carousel-item'>
<img alt='...' class='d-block w-100' src='https://1.bp.blogspot.com/-RsLYxQ6LElo/YGFsiqK1zNI/AAAAAAAAF8s/PzyjKOyecNsDxVdxQ2GJ15fnJCESdXIigCLcBGAsYHQ/s16000/%25D8%25A7%25D9%2584%25D8%25AA%25D8%25B3%25D8%25AC%25D9%258A%25D9%2584%2B%25D9%2581%25D9%2589%2B%25D9%2584%25D9%2582%25D8%25A7%25D8%25AD%2B%25D9%2583%25D9%2588%25D8%25B1%25D9%2588%25D9%2586%25D8%25A7%2B%25D9%2583%25D9%2588%25D8%25B1%25D9%2586%25D8%25A71.webp'/>
<div class='carousel-caption d-none d-md-block'>
<h5>Third slide label</h5>
<p>Some representative placeholder content for the third slide.</p>
</div>
</div>
</div>
<button class='carousel-control-prev' data-bs-slide='prev' data-bs-target='#carouselExampleCaptions' type='button'>
<span aria-hidden='true' class='carousel-control-prev-icon'/>
<span class='visually-hidden'>Previous</span>
</button>
<button class='carousel-control-next' data-bs-slide='next' data-bs-target='#carouselExampleCaptions' type='button'>
<span aria-hidden='true' class='carousel-control-next-icon'/>
<span class='visually-hidden'>Next</span>
</button>
</div>
</div>
```
你的问题不是很清楚。此代码创建图像和标题列表:
null
var items = document.querySelectorAll(".carousel-item"),
list = [];
for(let i = 0; i < items.length; i++)
{
let data = {};
data.img = items[i].querySelector("img");
data.title = items[i].querySelector(".carousel-caption > h5");
list[list.length] = data;
}
console.log("Title from second post: ", list[1].title.textContent);
console.log("Image url from third post: ", list[2].img.src);
console.log("list of all posts:");
console.log(list);
html prettyprint-override"><div class='flex-grow widget-inner'>
<div class='carousel slide' data-bs-ride='carousel' id='carouselExampleCaptions'>
<div class='carousel-indicators'>
<button aria-current='true' aria-label='Slide 1' class='active' data-bs-slide-to='0' data-bs-target='#carouselExampleCaptions' type='button'/>
<button aria-label='Slide 2' data-bs-slide-to='1' data-bs-target='#carouselExampleCaptions' type='button'/>
<button aria-label='Slide 3' data-bs-slide-to='2' data-bs-target='#carouselExampleCaptions' type='button'/>
</div>
<div class='carousel-inner'>
<div class='carousel-item active'>
<img alt='...' class='d-block w-100' src='https://1.bp.blogspot.com/-qq6KbFXzexw/YHoA4BaCfBI/AAAAAAAAF-8/o93DIHz4xa4zMMyYfmX_hDEDrUUardirwCLcBGAsYHQ/s16000/%25D9%2585%25D8%25A8%25D8%25A7%25D8%25B1%25D8%25A7%25D8%25A9%2B%25D8%25A7%25D9%2584%25D8%25A3%25D9%2587%25D9%2584%25D9%2589%2B%25D9%2588%25D8%25A7%25D9%2584%25D8%25B2%25D9%2585%25D8%25A7%25D9%2584%25D9%2583%2B18-4-2021.webp'/>
<div class='carousel-caption d-none d-md-block'>
<h5>First slide label</h5>
<p>Some representative placeholder content for the first slide.</p>
</div>
</div>
<div class='carousel-item'>
<img alt='...' class='d-block w-100' src='https://1.bp.blogspot.com/-vYM4UIdLty4/YHnxtDr8IcI/AAAAAAAAF-0/1JR8EZpgtIEyRlW7sffau6ost0dVJWlaQCLcBGAsYHQ/s16000/%25D8%25A8%25D8%25AB%2B%25D9%2585%25D8%25A8%25D8%25A7%25D8%25B4%25D8%25B1%2B%25D8%25A8%25D8%25B1%25D8%25B4%25D9%2584%25D9%2588%25D9%2586%25D8%25A9%2B%25D9%2588%25D8%25A7%25D8%25AA%25D9%2584%25D8%25AA%25D9%258A%25D9%2583%2B%25D8%25A8%25D9%2584%25D8%25A8%25D8%25A7%25D9%2588%2B%2B%25D8%25A8%25D8%25AF%25D9%2588%25D9%2586%2B%25D8%25AA%25D9%2582%25D8%25B7%25D9%258A%25D8%25B9%2B%2B%25D8%25A7%25D9%2584%25D8%25A7%25D9%2586.webp'/>
<div class='carousel-caption d-none d-md-block'>
<h5>Second slide label</h5>
<p>Some representative placeholder content for the second slide.</p>
</div>
</div>
<div class='carousel-item'>
<img alt='...' class='d-block w-100' src='https://1.bp.blogspot.com/-RsLYxQ6LElo/YGFsiqK1zNI/AAAAAAAAF8s/PzyjKOyecNsDxVdxQ2GJ15fnJCESdXIigCLcBGAsYHQ/s16000/%25D8%25A7%25D9%2584%25D8%25AA%25D8%25B3%25D8%25AC%25D9%258A%25D9%2584%2B%25D9%2581%25D9%2589%2B%25D9%2584%25D9%2582%25D8%25A7%25D8%25AD%2B%25D9%2583%25D9%2588%25D8%25B1%25D9%2588%25D9%2586%25D8%25A7%2B%25D9%2583%25D9%2588%25D8%25B1%25D9%2586%25D8%25A71.webp'/>
<div class='carousel-caption d-none d-md-block'>
<h5>Third slide label</h5>
<p>Some representative placeholder content for the third slide.</p>
</div>
</div>
</div>
<button class='carousel-control-prev' data-bs-slide='prev' data-bs-target='#carouselExampleCaptions' type='button'>
<span aria-hidden='true' class='carousel-control-prev-icon'/>
<span class='visually-hidden'>Previous</span>
</button>
<button class='carousel-control-next' data-bs-slide='next' data-bs-target='#carouselExampleCaptions' type='button'>
<span aria-hidden='true' class='carousel-control-next-icon'/>
<span class='visually-hidden'>Next</span>
</button>
</div>
</div>
问题内容: 首先,我知道在回答不能解决我的问题之前就已经问过这个问题了,所以我想再问一遍:我使用了“ W3school”的幻灯片代码,该代码提供了很好的动画Jquery幻灯片。不幸的是,我的页面上需要多个,第二个页面使第一个页面无法正常工作。甚至在这里找到此解决方案之前,我都尝试过更改不同幻灯片对象的CSS和HTML名称,从而成功地解决了一部分问题(第二个未显示),但是如前所述,第一个问题停止了工
问题内容: 我刚刚开始学习Angular.js,并且在Angular-ui中使用Carousel控件。是否可以同时显示两个幻灯片而不是一个? 我想显示这些图像- 这是一个示例- http://plnkr.co/edit/BnErmMDl8nPvXPrw3ULu?p=preview 问题答案: 您可以将图像分组在一起,也可以将其分组。除了一些所需的样式修复之外,以下是方法: http://plnkr
我是wordpress的新手,尝试使用钉板主题。我已经创建了不同的页面,我想在每个页面上显示属于一个类别的帖子。虽然,这似乎是一个相当常见的问题,但我仍然无法理解如何准确地做到这一点。 我假设我必须在某个地方编写此代码:- query_posts(category_name= 但是,我不知道我应该把它放在哪个文件/位置,如果我需要任何插件来工作。
我的中有10个选项卡。打开活动后,第一个片段就会显示出来,但下一个片段中的方法(AsyncTask)会被调用。如果我转到下一个选项卡,比如第3个选项卡,那么将调用第4个中的方法,依此类推。 我不理解这种行为。请救命!
特莫拉。png没有显示。 图片出现在我的代码中: 颤振抛出的错误: 资产图像/TMORA。png不存在。尝试创建文件或修复文件路径。dart(资产不存在)[51,8] 不过,这一形象确实存在。当我点击资产/图像文件夹时,我可以看到它 我相信问题源于我的yaml文件(如下所示) 完整的代码(将TMORA.png行注释掉以删除错误)出现在Github上 注意:我有两个名为images的文件夹。一个是p
问题内容: 如何在where子句中使用下个月的第一天和最后一天? 问题答案: 采用: