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
Post a Comment