我試圖根據一個widget的名稱引數來禁用swiper的自動播放功能,該引數為我提供了一個值。(我使用的是Magento widget,我從widget.xml中獲得了這個值)。) 下面是一個例子:
simulateTouch: <?= ($block->getData('is_gestures'/span>) =="1"/span>) ?'true':'false'?>,
//---- gestures end -----。
freeMode。true。
// --無限回圈 -----
回圈。<?= ($block->getData('infiniteLoop') =="1") ?'true':'false'?>。
//--自動播放----.
自動播放。{
延遲。2500,
disableOnInteraction: false,
},
對于其他的值,它很容易,因為它是一個真或假,但在這種情況下,我需要該代碼出現,如果我的$block->getData('autoplay') =="1",但我不知道如何做到這一點,我試過
($block->getData('autoplay') =="1"/span>) ?{延遲。2500, disableOnInteraction: false, },:'', or with the code inside'' but it bugs my swiper all the time
uj5u.com熱心網友回復:
<?= ($block->getData('autoplay') == "1") ?'{ delay: 2500, disableOnInteraction: false, }':'false'? >,
解決方案是將屬于autoplay == 1的代碼包裹在''中,在:為false之前,這樣就可以了
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/331370.html
標籤:
上一篇:大于單元格參考的查詢和不作業-GoogleSheets
下一篇:在R中對連續日期進行分組
