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

  • and what is wrong with drawing 150 places? And what's not to love about drawing divas? - Grundy
  • Did you see their code? There, the divas have done everything. It is clear that using the script. - KAGG Design

1 answer 1

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(); // ΠΌΠΎΠΆΠ½ΠΎ Ρ‡Π΅Ρ€Π΅Π· Π°Ρ‚Ρ€ΠΈΠ±ΡƒΡ‚Ρ‹ ΠΈ Ρ‚.ΠΏ. // Ρ‚Π°ΠΊ ΠΆΠ΅ Ρ‚ΡƒΡ‚ ΡƒΠΆΠ΅ ΠΌΠΎΠΆΠ½ΠΎ ΠΏΡ€ΠΎΠΏΠΈΡΠ°Ρ‚ΡŒ ΠΏΡ€ΠΈΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ стилСй ΠΏΡ€ΠΈ ΠΊΠ»ΠΈΠΊΠ΅ ΠΈ Ρ‚.ΠΏ. }) })