I have a div with a background image with an image nested inside of it. I am using a CSS class to set the background and positioning properties of that div. I would like for the user to control which background they see via a query string. The code behind would basically change (switch) the class of that div so that the background image would change based on the string typed in the address box.
Here is the HTML with the div and Css.
.background1 {
background-image: url(../Background1.png);
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: center center;
height: 100vh;
width: 100%;
max-height: 100vh;
max-width: 100vw;
margin-left: auto;
margin-right: auto;
display: block;
}
.background2 {
background-image: url(../Background2.png);
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: center center;
height: 100vh;
width: 100%;
max-height: 100vh;
max-width: 100vw;
margin-left: auto;
margin-right: auto;
display: block;
}
.background3 {
background-image: url(../Background3.png);
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: center center;
height: 100vh;
width: 100%;
max-height: 100vh;
max-width: 100vw;
margin-left: auto;
margin-right: auto;
display: block;
}
<div id="div" class="background1" runat="server"></div>
Here is what I (currently) have in the code behind.
if (Request["nobg"] != null)
{
div.Style.Add("display", "none");
}
So in the end I would like the user to switch between classes by typing in something like "?Background3" after the url to change the class (to see a different background) But I am sort of stuck as I really do not know if what I would like to do (switch between the background classes via query-string) is possible. Any help would be great. Thanks.