0

我正在 Prestashop 中做一个模块。我把花式横断面当作滑块。在根据文档的滑块中,我使用所有这些值来显示滑块

effect: '', // wave, zipper, curtain
width: 500, // width of panel
height: 332, // height of panel
strips: 20, // number of strips
delay: 5000, // delay between images in ms
stripDelay: 50, // delay beetwen strips in ms
titleOpacity: 0.7, // opacity of title
titleSpeed: 1000, // speed of title appereance in ms
position: 'alternate', // top, bottom, alternate, curtain
direction: 'fountainAlternate', // left, right, alternate, random, fountain, fountainAlternate
navigation: false, // prev and next navigation buttons
links: false // show images as links

在这里,我width,height and navigation从数据库中获取 的值。这样就可以手动为所有这些设置值。这适用于我从数据库中获取的宽度和高度。但是我从数据库中得到的导航值是真还是假都不起作用。每次它显示滑块导航。

这是我的 .tpl 文件中使用的代码

<script>
 var result_navigation="{$result_navigation}";
 var result_width="{$result_width}";
 var result_height="{$result_height}";
 $.fn.jqFancyTransitions.defaults = {  
      width: result_width, // width of panel
      height: result_height, // height of panel
      strips: 10, // number of strips
      delay: 5000, // delay between images in ms
      stripDelay: 50, // delay beetwen strips in ms
      titleOpacity: 0.7, // opacity of title
      titleSpeed: 1000, // speed of title appereance in ms
      position: 'alternate', // top, bottom, alternate, curtain
      direction: 'fountainAlternate', // left, right, alternate, random, fountain, fountainAlternate
      effect: '', // curtain, zipper, wave
      navigation: result_navigation, // prev next and buttons
      links : true // show images as links     
    };
 </script>

这里作为 result_width 的宽度和作为 result_height 的高度的值工作正常。但是 result_navigation 的值与false or true value. 但是当我在代码中使用它时它不起作用。它显示导航就像值是真的一样。false 的值在这里不起作用。有人可以告诉我如何解决这个问题吗?任何帮助和建议都将是非常可观的。谢谢

4

1 回答 1

0

检查 的输出{$result_navigation}。当您使用引号时,您正在传递一个字符串,这在 js 代码中将被视为 true-ish。你应该尝试这样的事情:

<script>
    // if you use a boolean
    var result_navigation = {if $result_navigation}true{else}false{/if};

    // if you use `true` or `false` as strings - but that's just weird
    var result_navigation = {if $results_navigation == 'true'}true{else}false{/if};

</script>
于 2013-05-31T14:02:08.087 回答