mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-29 14:35:18 -04:00
Improves selectors.
This commit is contained in:
parent
ad845dbe66
commit
66e9dafaa5
6 changed files with 50 additions and 67 deletions
|
@ -115,31 +115,14 @@ modulejs.define('ext/select', ['_', '$', 'core/settings', 'core/resource', 'core
|
|||
initItem = function (item) {
|
||||
|
||||
if (item.$view) {
|
||||
item.$view.find('a')
|
||||
.on('mouseenter', function () {
|
||||
item.$view.find('.selector').on('click', function (event) {
|
||||
|
||||
var $icon = item.$view.find('.icon');
|
||||
event.stopImmediatePropagation();
|
||||
event.preventDefault();
|
||||
|
||||
$('#selector').remove();
|
||||
$('<div id="selector">' +
|
||||
'<img src="' + resource.image('select') + '" class="on-selected" alt="selected" />' +
|
||||
'<img src="' + resource.image('blank') + '" class="on-not-selected" alt="not-selected" />' +
|
||||
'</div>')
|
||||
.on('click', function (event) {
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
event.preventDefault();
|
||||
|
||||
item.$view.toggleClass('selected');
|
||||
publish();
|
||||
})
|
||||
.appendTo(item.$view.find('a'));
|
||||
})
|
||||
.on('mouseleave', function () {
|
||||
|
||||
$('.hover').removeClass('hover');
|
||||
$('#selector').remove();
|
||||
});
|
||||
item.$view.toggleClass('selected');
|
||||
publish();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue