Question about adding image attribute in combination with js
Permalink
I want to change the image url to a attribute image. Please help me with the right code for it.
I tried ("headerimg" is the attribute name)
I tried
<?php $img = $c->getAttribute('headerimg'.$i); ?>
<!-- PAGE TITLE BACKGROUND IMAGE --> <script type="text/javascript"> <script type="text/javascript"> jQuery(document).ready(function () { "use strict"; jQuery('#page-title-container').backstretch("images/photos/1800x1000.gif", { fade: 500 }); }); </script>
You can try this:
<script> jQuery(document).ready(function () { "use strict"; jQuery('#page-title-container').backstretch("<?php if (is_object($c->getAttribute('headerimg'))) { echo $c->getAttribute('headerimg')->getRelativePath(); } ?>", { fade: 500 }); }); </script>