Answer the question
In order to leave comments, you need to log in
How to set the block background by clicking on the image?
Good day. There is a block with pictures (.img-container) that are output from the server.
How to make it so that when you click on an image, the src of this image is taken and transferred to the background of the block (.bg-box)?
Here is an example: u0763918test1.isp.regruhosting.ru
<div class="img-container">
<?php
include('gallery.php');
?>
</div>
<div class="bg-box">
Answer the question
In order to leave comments, you need to log in
jQuery change the css property of the block
jQuery('#your_button_id').on('click',function(){ jQuery(desired_div).css('background_image','url'); ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question