forked from 0x2620/oxjs
update infolist
This commit is contained in:
parent
57ed9f9680
commit
5d669f42e3
4 changed files with 60 additions and 38 deletions
|
|
@ -19,8 +19,7 @@ Ox.InfoList = function(options, self) {
|
|||
})
|
||||
.options(options || {})
|
||||
|
||||
self.iconHeight = Math.round(self.options.size * 2/3);
|
||||
self.iconWidth = self.iconHeight;
|
||||
self.iconSize = Math.round(self.options.size * 2/3);
|
||||
self.itemHeight = self.options.size;
|
||||
|
||||
that.$element = Ox.List({
|
||||
|
|
@ -55,10 +54,10 @@ Ox.InfoList = function(options, self) {
|
|||
? self.options.item(data, self.options.sort, self.options.size)
|
||||
: {
|
||||
icon: {
|
||||
width: Math.round(self.options.size * (
|
||||
width: Math.round(self.iconSize * (
|
||||
self.options.defaultRatio >= 1 ? 1 : self.options.defaultRatio
|
||||
)),
|
||||
height: Math.round(self.options.size / (
|
||||
height: Math.round(self.iconSize / (
|
||||
self.options.defaultRatio <= 1 ? 1 : self.options.defaultRatio
|
||||
))
|
||||
},
|
||||
|
|
@ -77,13 +76,13 @@ Ox.InfoList = function(options, self) {
|
|||
.append(
|
||||
Ox.IconItem(Ox.extend(data.icon, {
|
||||
borderRadius: self.options.borderRadius,
|
||||
iconHeight: 128, //self.iconHeight,
|
||||
iconWidth: 128, //self.iconWidth,
|
||||
imageHeight: data.height,
|
||||
imageWidth: data.width,
|
||||
iconHeight: self.iconSize,
|
||||
iconWidth: self.iconSize,
|
||||
imageHeight: data.icon.height,
|
||||
imageWidth: data.icon.width,
|
||||
isInfoList: true,
|
||||
itemHeight: self.itemHeight,
|
||||
itemWidth: 128,
|
||||
itemWidth: 128
|
||||
}))
|
||||
.addClass('OxInfoIcon')
|
||||
.css({
|
||||
|
|
@ -93,16 +92,15 @@ Ox.InfoList = function(options, self) {
|
|||
$info = Ox.Element()
|
||||
.css({
|
||||
float: 'left',
|
||||
width: getItemWidth() - 152 + 'px',
|
||||
height: '192px',
|
||||
margin: '4px',
|
||||
width: getItemWidth() - 144 + 'px',
|
||||
height: 196 + 'px',
|
||||
//background: 'green'
|
||||
}),
|
||||
$infobox = Ox.Element()
|
||||
.css({
|
||||
position: 'absolute',
|
||||
width: getItemWidth() - 152 + 'px',
|
||||
height: '192px',
|
||||
width: getItemWidth() - 144 + 'px',
|
||||
height: 196 + 'px',
|
||||
overflow: 'hidden'
|
||||
})
|
||||
.appendTo($info);
|
||||
|
|
@ -119,9 +117,10 @@ Ox.InfoList = function(options, self) {
|
|||
var $element = data.info.element(Ox.extend(data.info.options, {
|
||||
width: getItemWidth() - 152
|
||||
}))
|
||||
.addClass('OxInfoElement')
|
||||
.css(data.info.css);
|
||||
$element.addClass('OxId' + $element.id);
|
||||
.addClass('OxInfoElement');
|
||||
data.info.css && $element.css(data.info.css);
|
||||
data.info.events && $element.bindEvent(data.info.events);
|
||||
$element.addClass('OxId' + $element.id); // fixme: needed?
|
||||
$infobox.append($element);
|
||||
}
|
||||
return $item;
|
||||
|
|
@ -149,6 +148,7 @@ Ox.InfoList = function(options, self) {
|
|||
if (key == 'items') {
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'selected') {
|
||||
Ox.print('SELECTED', value)
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'sort') {
|
||||
that.$element.options(key, value);
|
||||
|
|
@ -157,8 +157,8 @@ Ox.InfoList = function(options, self) {
|
|||
$('.OxInfoElement').each(function() {
|
||||
var $parent = $(this).parent(),
|
||||
id = parseInt(/OxId(.*?)$/.exec(this.className)[1]);
|
||||
$parent.css({width: width - 152});
|
||||
$parent.parent().css({width: width - 152});
|
||||
$parent.css({width: width - 144});
|
||||
$parent.parent().css({width: width - 144});
|
||||
$parent.parent().parent().css({width: width - 8});
|
||||
Ox.print('@@@', this.className, id)
|
||||
Ox.UI.elements[id].options({width: width - 152});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue