markdown 直接在产品页面上的叙事产品图像模式幻灯片

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 直接在产品页面上的叙事产品图像模式幻灯片相关的知识,希望对你有一定的参考价值。

**Theme:** Narrative

**Last version(s) tested:** 6.0.5

**Recommended design time:** 15 minutes


----

## What you have
![](https://screenshot.click/29-41-lpuzf-65iug.gif)

## What you want
![](https://screenshot.click/29-38-r17cb-oqkvf.gif)

----

## What you do

**Step 1:** Open product-template.liquid and change

```
<div class="page-width page-width--no-gutter">
```
to
```
<div class="page-width page-width--no-gutter" style="display: none;">
```

**Step 2:** Just above the div we just edited add this:
```
  <div id="appendSlideshow"></div>
```


It should now look like this:
![](https://screenshot.click/29-26-vys3c-nj7s4.jpg)


**Step 3:** In the same file, add this code to the bottom of the file, just before the schema starts

```
<style>
  .product-slideshow {
    height: 700px !important;
    position: inherit !important;
  }
</style>

<script>
  window.onload = function(e){ 
    let appendElement = document.getElementById("appendSlideshow")
    let slideshow = document.getElementsByClassName("product-slideshow")[0]
    appendElement.appendChild(slideshow); 
    document.getElementsByClassName("product-slideshow__open")[0].click();
  }
</script>
```

**Step 4:** Find and comment out the utils.disableScrollBody() and trapfocus in theme.js (around line 5630 in Narrative 6.0.5) like so:
![](https://screenshot.click/08-10-u5r5q-vmvr5.jpg)



----

**Additional notes:**

If it doesn’t work you might need to remove the .min from the theme.liquids theme.min.js import to make sure the theme isn't loading the minified unmodified js file

以上是关于markdown 直接在产品页面上的叙事产品图像模式幻灯片的主要内容,如果未能解决你的问题,请参考以下文章

单个产品页面上的 Woocommerce 钩子溢出

markdown 在精选集合中显示两个产品图像

markdown 在产品单页面上添加自定义标签

将添加到购物车按钮替换为链接到 WooCommerce 3 中商店页面上的产品页面的更多内容

markdown FCC:产品登陆页面

markdown 将库存指示器按钮添加到产品页面