dom - Already loaded images change -
i have webpage n small divs containing each different image, , bigger 1 no image in in.
all smaller divs have set background this: background-image:url(image1.jpg) , on.
when clicking on each div, want set bigger div clicked smaller div's background image, using following code:
$("#largediv").css({ 'background-image': $(this).css('background-image') }); or alternatively, use this:
$("#largediv").css({ 'background-image': "url(image1.jpg)" //i have access id anyway. }); now, both codes work perfectly, problem following, tho: have feeling everytime issuing these commands, browser sending http request server picture, if not download it, it's checking of image still online. found out disabling wifi once page loaded: clicking not change image on bigger div anymore.
can explain me why, if there work around issue, or if that's problem? , also, 1 of 2 codes provided better use, considering images should loaded in page?
thanks in advance
Comments
Post a Comment