我在Prestashop做一个模块。我把fancytransection作为滑块。在按照文档的滑块中,我使用所有这些值来显示滑块
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的width_width和height的宽度值一直正常。但是,使用false or true value
可以获得result_navigation的值。但是当我在代码中使用它时,它无法正常工作。它显示导航就像值是真的一样。 false的值在这里不起作用。有人可以告诉我如何解决这个问题吗?任何帮助和建议都会非常明显。感谢
答案 0 :(得分:0)
检查{$result_navigation}
的输出。当你使用引号时,你传递的是一个字符串,在js代码中它将被视为真实的。你应该尝试这样的事情:
<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>