This is working, but there is probably a better way to pass the php var. does anyone have any options? thanks
<?php $slide = "fade"; ?>
$(document).ready(function()
{
$("#showcase_right").awShowcase({transition : "<?php echo $slide; ?>"});
});
The better way would be using
json_encodeto convert the PHP string to JavaScript. In this case it makes no real difference but when you have other strings it ensures that you’ll always have valid JavaScript no matter what the PHP variable contains.Another option would be storing the value e.g. in a
data-attribute, e.g. in the<body>tag:Then you can access it in your JavaScript code using
$('body').data('transition')