Analogue features that I want to do - https://multiplex.ua/cinema/victoriaplaza . This is the hall, when you choose a session, I want about the same, but I need to impose 4 different halls, not to draw them with divas? I wanted to learn from the pro how to do this correctly, because I will use jquery and draw blocks of 150 places ...., which is not very reasonable, tell me plis
1 answer
Well, as in the comments they write, what is the problem of drawing with divas for example:
Making a hall div:
<div class='hall'></div> You describe in css styles for .hall - this is our hall itself and .hall__place is a place in the hall
Then on jQuery for example you make the following code:
// ΡΡΠ½ΠΊΡΠΈΡ Π΄Π»Ρ Π³Π΅Π½Π΅ΡΠ°ΡΠΈΠΈ ΠΌΠ΅ΡΡ function generateHall(places) { // places - ΠΊΠΎΠ»-Π²ΠΎ ΠΌΠ΅ΡΡ Π² Π·Π°Π»Π΅ var $hall = $('.hall'); $hall.empty(); for (var i=0; i<places; i++ ) { $hall.append('<div class="hall_place">'+i+'</div>'); } } $(function() { generateHall(150); // Π³Π΅Π½Π΅ΡΠ°ΡΠΈΡ ΠΌΠ΅ΡΡ, ΠΌΠΎΠΆΠ΅ΡΡ ΠΈΡΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΡ Π³Π΄Π΅ ΡΠ³ΠΎΠ΄Π½ΠΎ // ΠΎΠ±ΡΠ°Π±ΠΎΡΡΠΈΠΊ ΡΠΎΠ±ΡΡΠΈΡ ΠΊΠ»ΠΈΠΊ $('body').on('click', '.hall_place', function() { var $this = $(this), num_place = $this.text(); // ΠΌΠΎΠΆΠ½ΠΎ ΡΠ΅ΡΠ΅Π· Π°ΡΡΠΈΠ±ΡΡΡ ΠΈ Ρ.ΠΏ. // ΡΠ°ΠΊ ΠΆΠ΅ ΡΡΡ ΡΠΆΠ΅ ΠΌΠΎΠΆΠ½ΠΎ ΠΏΡΠΎΠΏΠΈΡΠ°ΡΡ ΠΏΡΠΈΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ ΡΡΠΈΠ»Π΅ΠΉ ΠΏΡΠΈ ΠΊΠ»ΠΈΠΊΠ΅ ΠΈ Ρ.ΠΏ. }) }) |