0.0.1 new functional twb
This commit is contained in:
42
static/v2/js/widgets/w_select_country.js
Normal file
42
static/v2/js/widgets/w_select_country.js
Normal file
@@ -0,0 +1,42 @@
|
||||
function toggleSelectCountry(el, callback) {
|
||||
if (!el) return;
|
||||
|
||||
let $parent = el.closest('.w_select_country');
|
||||
if (!$parent) return;
|
||||
|
||||
if ($parent.classList.contains('closed')) {
|
||||
openSelectCountry(el, callback)
|
||||
} else {
|
||||
closeSelectCountry(el, callback);
|
||||
}
|
||||
}
|
||||
|
||||
function openSelectCountry(el, callback) {
|
||||
let $parent = el.closest('.w_select_country');
|
||||
if (!$parent) return;
|
||||
|
||||
$parent.classList.remove('closed');
|
||||
|
||||
if (callback) callback('opened', $parent);
|
||||
}
|
||||
|
||||
function closeSelectCountry(el, callback) {
|
||||
let $parent = el.closest('.w_select_country');
|
||||
if (!$parent) return;
|
||||
|
||||
$parent.classList.add('closed');
|
||||
|
||||
if (callback) callback('closed', $parent);
|
||||
}
|
||||
|
||||
function searchCountry(el) {
|
||||
let request = new api({
|
||||
url: '',
|
||||
data: '',
|
||||
data_type: 'formData',
|
||||
success: function (data) {
|
||||
}, error: function (data) {
|
||||
}
|
||||
});
|
||||
request.ajaxRequest()
|
||||
}
|
||||
Reference in New Issue
Block a user