В общем, есть скрипт конструктор заказа.
Не работает на мобильных устройствах из-за отсутсвия кроссбраузерности. Понятия не имею что нужно делать (
<script>
var total_amount = 0;
$(document).ready(function(){
$('.drag').on("dragstart", function (event) {
var dt = event.originalEvent.dataTransfer;
dt.setData('id', $(this).attr('id'));
});
$('table td').on("dragenter dragover drop", function (event) {
event.preventDefault();
if(event.type === 'drop') {
if($(this).html() != '') {
return false;
}
var id = event.originalEvent.dataTransfer.getData('id', $(this).attr('id'));
if($(this).attr('data-id') != id) {
return false;
}
var el = $('#'+id);
var amount = parseFloat(el.attr('data-amount'));
if(el.attr('data-type') == 'in') {
total_amount -= amount;
el.attr('data-type', 'out');
} else {
el.attr('data-type', 'in');
total_amount += amount;
}
$('#total-amount').html(total_amount + ' руб.');
el.detach();
el.appendTo($(this));
};
});
})
</script>
<div class="container">
<table class="table table-bordered">
<!--Список услуг-->
<tr>
<td data-id=""><span id="" class="drag">Список услуг</span></td>
<td data-id="a1"><span id="a1" data-type="out" data-amount="100" class="btn btn-default drag" draggable="true">100 руб.<p>Услуга 1</p></span></td>
<td data-id="a2"><span id="a2" data-type="out" data-amount="200" class="btn btn-default drag" draggable="true">200 руб.<p>Услуга 2</p></span></td>
<td data-id="a3"><span id="a3" data-type="out" data-amount="300" class="btn btn-default drag" draggable="true">300 руб.<p>Услуга 3</p></span></td>
<td data-id="a4"><span id="a4" data-type="out" data-amount="400" class="btn btn-default drag" draggable="true">400 руб.<p>Услуга 4</p></span></td>
<td data-id="a5"><span id="a5" data-type="out" data-amount="300" class="btn btn-default drag" draggable="true">300 руб.<p>Услуга 5</p></span></td>
<td data-id="a6"><span id="a6" data-type="out" data-amount="500" class="btn btn-default drag" draggable="true">500 руб.<p>Услуга 6</p></span></td>
<td data-id="a7"><span id="a7" data-type="out" data-amount="100" class="btn btn-default drag" draggable="true">100 руб.<p>Услуга 1</p></span></td>
<td data-id="a8"><span id="a8" data-type="out" data-amount="200" class="btn btn-default drag" draggable="true">200 руб.<p>Услуга 2</p></span></td>
<td data-id="a9"><span id="a9" data-type="out" data-amount="300" class="btn btn-default drag" draggable="true">300 руб.<p>Услуга 3</p></span></td>
<td data-id="a10"><span id="a10" data-type="out" data-amount="400" class="btn btn-default drag" draggable="true">400 руб.<p>Услуга 4</p></span></td>
<td data-id="a11"><span id="a11" data-type="out" data-amount="300" class="btn btn-default drag" draggable="true">300 руб.<p>Услуга 5</p></span></td>
<td data-id="a12"><span id="a12" data-type="out" data-amount="500" class="btn btn-default drag" draggable="true">500 руб.<p>Услуга 6</p></span></td>
</tr>
<!--Типо карзина-->
<tr>
<td data-id=""><span id="" class="drag">Выбранные услуги</span></td>
<td data-id="a1"></td>
<td data-id="a2"></td>
<td data-id="a3"></td>
<td data-id="a4"></td>
<td data-id="a5"></td>
<td data-id="a6"></td>
<td data-id="a7"></td>
<td data-id="a8"></td>
<td data-id="a9"></td>
<td data-id="a10"></td>
<td data-id="a11"></td>
<td data-id="a12"></td>
</tr>
</table>
<!--Сумма заказа-->
Сумма: <span id="total-amount">0 руб.</span>
<br>
<br>
<button data-toggle="modal" data-target="#order-modal" class="btn btn-success" onclick="">Заказать</button>
</div>
<div class="modal fade" tabindex="-1" role="dialog" id="order-modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title">Оформить заказ</h4>
</div>
<div class="modal-body">
<div id="success-message" class="alert alert-success" style="display: none">Ваш заказ успешно отправлен</div>
<form>
<div class="form-group">
<label>Ваше имя: </label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<label>Ваше телефон: </label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<label>Ваше email: </label>
<input type="text" class="form-control">
</div>
<div class="form-group">
<label>Коментарий: </label>
<input type="text" class="form-control">
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Отмена</button>
<button type="button" class="btn btn-primary" onclick="$('#success-message').show()">Оформить заказ</button>
</div>
</div>
</div>
</div>
gfsell.ru/001.php
HELP!!!!!!!!!!!!!!!!!!!