[bgstretcher] javascript while loading template

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
vinyl
Forum Members
Forum Members
Posts: 149
Joined: Mon Jul 13, 2009 8:18 pm

[bgstretcher] javascript while loading template

Post by vinyl »

I want to use the jquery script "bgstretcher". What that does is stretch a background image you supply to whatever size your window is.

I have it working correctly but I would like someone to be able to choose it within CMSMS.

The way you set it is by adding the path to an image within the javascript.

Code: Select all

$(document).ready(function(){
        //  Initialize Backgound Stretcher	   
		$(document).bgStretcher({
			images: ['uploads/site/images/image.jpg'],
			imageWidth: 800, imageHeight: 600
		});
The script is placed in the "Page Specific Metadata" field of my page.

Is there anyway to include a variable in there or maybe load this with the gallery and pass a variable so you are able to choose an image?

I could make a gallery with only one image that is active, so that solves the choosing, but how can I pass that in the javascript that is loaded with my page?

Any ideas?
uniqu3

Re: [bgstretcher] javascript while loading template

Post by uniqu3 »

You could use {content_image} tag for image selection, or if you want to be able to see image thumb look at GBFilePicker module.

So in your js code you could do following:

Code: Select all

{literal}
$(document).ready(function(){
        //  Initialize Backgound Stretcher      
      $(document).bgStretcher({
         images: ['{/literal}{content_image block='bg_image' dir='yourpath'}{literal}'],
         imageWidth: 800, imageHeight: 600
      });
{/literal}
vinyl
Forum Members
Forum Members
Posts: 149
Joined: Mon Jul 13, 2009 8:18 pm

Re: [bgstretcher] javascript while loading template

Post by vinyl »

Ah ok, I could use that! Thanks, will check it out tonight.
Post Reply

Return to “The Lounge”