javascript - background-image: url not working properly -


the problem encountering when use javascript html file inside html file, background image turns invisible. when open file background image image visible.

to make understandable, want include second.html (with background image) in first.html using javascript without image being invisible.

first.html (main)

<html>     <head>         <script>              $(function(){                 $("#second").load("second.html");             });         </script>      </head>     <body>         <div id="second"></div>     </body> </html> 

second.html (with image)

<body style="background-image: url('img/dashboard-layout.png'); background-repeat: no-repeat; background-color: #303032;">     <!--code goes here--> </body> 

this working example first.html

<html>   <head> 
    <script>         $(function(){             $("#second").load("second.html");         });     </script>     </head>    <body>       <div id="second" style="height:100px;width:100%;"></div>    </body> 

second.html

<div style="height:100px;width:100%;background-image: url('http://blogs.atlassian.com/wp-content/uploads/01-new-icons.png'); background-color: #303032;"> 

note div has default height = 0px need set height divs work eg.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -