Answer the question
In order to leave comments, you need to log in
How to optimize the process of updating pictures?
There are 2 blocks (table,apple)
<div class="gen table"></div>
<div class="gen apple"></div>
.gen{
width: 50%;
height: 50%;
position: absolute;
}
.table{
background-image: url("table/1.png");
}
.apple{
background-image: url("apple/1.png");
}
<div class="butt">
<button id="table1"> Стол 1</button>
<button id="table2"> Стол 2</button>
<button id="table3"> Стол 3</button>
<button id="table4"> Стол 4</button>
<br>
<br>
<button id="apple1"> Яблоко 1</button>
<button id="apple2"> Яблоко 2</button>
<button id="apple3"> Яблоко 3</button>
<button id="apple4"> Яблоко 4</button>
</div>
$( "#table1" ).click(function() {
$( ".table" ).css( "background-image",' url("table/1.png")' );
});
$( "#table2" ).click(function() {
$( ".table" ).css( "background-image",' url("table/2.png")' );
});
$( "#table3" ).click(function() {
$( ".table" ).css( "background-image",' url("table/3.png")' );
});
$( "#table4" ).click(function() {
$( ".table" ).css( "background-image",' url("table/4.png")' );
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question