开发者

Sharepoint Theme specific image

开发者 https://www.devze.com 2022-12-14 20:04 出处:网络
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.

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?


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号