IconList: add support for icon extra (overlay)

This commit is contained in:
rolux 2014-05-10 15:11:31 +02:00 committed by j
parent 6682aa9999
commit 33eff9f46d

View file

@ -26,6 +26,7 @@ Ox.IconItem = function(options, self) {
var that = Ox.Element({}, self) var that = Ox.Element({}, self)
.defaults({ .defaults({
borderRadius: 0, borderRadius: 0,
extra: null,
find: '', find: '',
iconHeight: 128, iconHeight: 128,
iconWidth: 128, iconWidth: 128,
@ -155,6 +156,28 @@ Ox.IconItem = function(options, self) {
) )
); );
if (self.options.extra) {
that.$extra = $('<div>')
.addClass('OxTarget')
.css({
position: 'absolute',
left: 0,
right: 0,
bottom: 0,
width: self.options.imageWidth + 'px',
height: self.options.imageHeight + 'px',
border: '2px solid transparent',
margin: 'auto',
cursor: 'pointer',
overflow: 'hidden'
})
that.$icon.append(
that.$extra.append(
self.options.extra
)
);
}
function formatText(text, maxLines, maxLength) { function formatText(text, maxLines, maxLength) {
text = Ox.isArray(text) ? text.join(', ') : text; text = Ox.isArray(text) ? text.join(', ') : text;
var lines = Ox.wordwrap(text, maxLength, true).split('\n'); var lines = Ox.wordwrap(text, maxLength, true).split('\n');