L
L
Little Vasya2018-05-18 10:48:21
JavaScript
Little Vasya, 2018-05-18 10:48:21

How to make an interactive table reservation system?

It is necessary to implement a map where you can click on an object and it will be highlighted in yellow, which libraries do you recommend or how to implement the logic?
5afe8540cfcd7283263672.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2018-05-18
@Casufi

https://d3js.org/
Implement the logic with the help of the head and some hands and ass.

D
Daniil Ivanov, 2018-05-22
@DanialKA

No graphics libraries needed. You need riot.js. and jquery for ajax.
Each square is an object in the array. Change object state on click

<my-field >
    <div class="fields-wrap">
        <div each="{row in fields}" class="fields-row">
            <button onclick="{toggleActive}" each="{field in row}" class="fields-item {active: field.isActive}">{field.place}</button>    
        </div>
    </div>
    <script>
        var fields = [
            [
                {place:1,isActive:false},
                {place:2,isActive:false},
                {place:3,isActive:false},
                {place:4,isActive:false},
                {place:5,isActive:false}
            ],
            [
                {place:1,isActive:false},
                {place:2,isActive:false},
                {place:3,isActive:false},
                {place:4,isActive:false},
                {place:5,isActive:false}
            ],
            [
                {place:1,isActive:false},
                {place:2,isActive:false},
                {place:3,isActive:false},
                {place:4,isActive:false},
                {place:5,isActive:false}
            ],
            [
                {place:1,isActive:false},
                {place:2,isActive:false},
                {place:3,isActive:false},
                {place:4,isActive:false},
                {place:5,isActive:false}
            ],
            [
                {place:1,isActive:false},
                {place:2,isActive:false},
                {place:3,isActive:false},
                {place:4,isActive:false},
                {place:5,isActive:false}
            ]
        ]
        toggleActive(e){
            e.item.isActive = !e.item.isActive;
        }
    </script>
</my-field>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question