I want to load a background image from another ajax page and Im not really sure whats th开发者_如何学运维e best way?
In my index.html page I have the css background code and I want to load an image from another asp page.
My index.html file as it looks now:
<div id="bgimage" style="background-image: url(../images/theimage.jpg); background-repeat: no-repeat; background-position: center center; background-attachment:fixed;">
and the imagepage.asp page that gets the right image from the db.
<div id="menuimage">
<img src="..user_images/<%=folderName%>/menuimage/<%=rs("big_image")%>" id="themenyimage"/>
</div>
Any suggestions appriciated, thanks.
Something along the lines of
var temp_div = $('<div></div>');
temp_div.load('path.asp #menuimage', function() {
$('#bgimage').css('background-image', temp_div.find('img').first().attr('src');
});
Can probably be optimised etc.
精彩评论