views:

79

answers:

2

In my Sharepoint masterpage I have added an <img> to the top of the <body> of the page so that I can use some CSS to set the <img> to fill the screen.

However I want a different image to be displayed depending on the theme in use. I currently use the following inside the masterpage:

<img alt="" id="fullscreen" src="/_layouts/images/Background.png" />

Is it possible to capture the name of the theme in use and append that to the file name so I can simple adjust file names to match there theme?

Or failing that can I add something to src=" " that will make the URL theme specific?

A: 

What about defaulting the images to hidden, and in the CSS for the theme you want it shown in, show it?

For example:

In your master page:

<img src="theme1.jpg" alt="" id="theme1fullscreen" style="display: hidden;" />
<img src="theme2.jpg" alt="" id="theme2fullscreen" style="display: hidden;" />
<img src="theme3.jpg" alt="" id="theme3fullscreen" style="display: hidden;" />

In the css for Theme X:

#themeXfullscreen {
    display: block;
    height: 100%;
    width: 100%;
}

This way, you have the images and locations in the master page, and can hide and show the appropriate one based on the theme.

Kyle Trauberman
The location of the image cannot be held within the CSS, the image must be held within the page. This is so that I can use CSS to set the image to be 100% width and 100% height depending on the size of the browser.
danit
Why can't you hold the location of the image in the CSS and set the height and width of the image to 100%. I don't think there is any technical limitation that prevents this. In any case, I will edit my answer to provide clarification regarding what I was suggesting.
Kyle Trauberman
A: 

I think the idea is to reference the images from your theme CSS. So if an image changes between themes, the url to that image is stored in each of the theme CSS files. You master page can then simply contain an element with always the same CSS class.

ArjanP