First of all, let me explain the structure of the page so that you can understand how it works. I have a few blocks quick-button. They can be sorted by the Jquery ui method .sortable(), but only after clicking the button settings(which allows you to quickly sort the buttons). Later, the order of these buttons could be saved or canceled. Therefore, I need to look at the three conditions that are triggered by the event click. The problem is that the first time everything is fine, but the second time I try to press the settings- button sortable(), the method no longer works.
You can see my JS below:
$('#tune-hot-links').click(function () {
$(".sect-hot-links-inner").sortable();
$(".sect-hot-links-inner").disableSelection();
});
$('.button-editgroup button.button-save').click(function () {
$(".sect-hot-links-inner").sortable('disabled');
$(".sect-hot-links-inner").enableSelection();
});
$('.button-editgroup button.button-cancel').click(function () {
$(".sect-hot-links-inner").sortable('cancel');
$(".sect-hot-links-inner").sortable('disabled');
$(".sect-hot-links-inner").enableSelection();
});
I already tried to change .sortable()to .sortable('enable')an event #tune-hot-links. And it does not work.