2013-05-31 37 views
0

我在Prestashop中做了一个模块。我已将fancytransection作为滑块。在滑块按文件我使用所有这些值显示滑块从数据库中提取时,jQuery滑块插件值不起作用?

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一起取得良好。但是当我在代码中使用它时,它不起作用。它显示的导航就像值是真的一样。虚假的价值在这里不起作用。有人可以告诉我如何解决这个问题吗?任何帮助和建议都将非常可观。谢谢

回答

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> 
+0

感谢您的回复。是的,我得到'{$ result_navigation}'的输出为false或true。但不知道为什么它不在这里工作。 – NewUser

+0

但是你输出false或true作为字符串或布尔? – romainberger

+0

我得到的值为varchar .... – NewUser