Gogul
Gogul

Reputation: 11

How to declare CSS properties for a div in SHADOWBOX?

I have created a code to open a div using shadowbox, but I am unable to set CSS properties for that Div. This is my code.

<style>
.h2class {
    font-family:'Century Gothic';
    font-weight:lighter;
    color:white;
    padding-left:10px;
}
.DivClass1 {
    display:none;
    background-image:url(~/Images/Image1.jpg);
    background-repeat:no-repeat;
    background-size:cover;

}
</style>
<script>
$(document).ready(function () {
            $(function () {
                Shadowbox.init({
                    skipSetup: true
                });

                $('#Link1').click(function () {
                    var content = $('#Div1').html();
                    Shadowbox.open({
                        content: content,
                        player: 'html',
                        displayNav: false,
                        height: 500,
                        width:400
                    });
                });
</script>
<div id="Div1" class="DivClass1">
                <h2 class="h2class">Hello/h2>
            </div>
<a id="Link1" href="#">Click Me</a>

I need to give background image or a background color to Div1. Please help!!

Upvotes: 0

Views: 118

Answers (2)

evilunix
evilunix

Reputation: 960

It's because Shadowbox is only using the CONTENT of #Div1, not it's style. I'm not familiar with shadowbox, but there is probably another config item in Shadowbox.open which will let you style the div.

Upvotes: 0

Viswanath Donthi
Viswanath Donthi

Reputation: 1821

Simply add css to Div1 as:

#Div1{
    background: #CCCCCC;
}

Upvotes: 0

Related Questions