Saturday 11 January 2014

Add thumbnail in pages - PyroCMS



For adding thumbnail in Pyrocms page....

Simple add a img tag in every page content page body

ex:

<img src="URL OF YOUR IMAGE" id="headerimg" style="display:none;" class="" alt="" title=""/>



Now add this javascript in your default.html under addons > themes > layout.

<script>
(function(){
   
var headerimage = document.getElementById("headerimg").src;
window.onload = function() {
       //when the document is finished loading, replace everything
       //between the <a ...> </a> tags with the value of splitText
   document.getElementById("myLink").src=headerimage;
}

})();

</script>



And finally add an image tag where you want to display your banner image.i used it in main.html under addons > themes > partials.

like this :
<img id="myLink" src="">

For demo

Thanks






No comments:

Post a Comment