9 * @class Roo.bootstrap.MasonryBrick
10 * @extends Roo.bootstrap.Component
11 * Bootstrap MasonryBrick class
14 * Create a new MasonryBrick
15 * @param {Object} config The config object
18 Roo.bootstrap.MasonryBrick = function(config){
19 Roo.bootstrap.MasonryBrick.superclass.constructor.call(this, config);
25 * When a MasonryBrick is clcik
26 * @param {Roo.bootstrap.MasonryBrick} this
27 * @param {Roo.EventObject} e
33 Roo.extend(Roo.bootstrap.MasonryBrick, Roo.bootstrap.Component, {
44 * @cfg {String} bgimage
56 * @cfg {String} (xs|sm|md|md-left|md-right|tall|wide) size
61 * @cfg {String} (center|bottom) placetitle
65 getAutoCreate : function()
67 var cls = 'masonry-brick';
70 cls += ' masonry-brick-link';
73 if(this.bgimage.length){
74 cls += ' masonry-brick-image';
78 cls += ' masonry-' + this.size + '-brick';
81 if(this.placetitle.length){
83 switch (this.placetitle) {
85 cls += ' masonry-center-title';
88 cls += ' masonry-bottom-title';
95 if(!this.html.length && !this.bgimage.length){
96 cls += ' masonry-center-title';
99 if(!this.html.length && this.bgimage.length){
100 cls += ' masonry-bottom-title';
105 cls += ' ' + this.cls;
109 tag: (this.href.length) ? 'a' : 'div',
114 cls: 'masonry-brick-paragraph',
120 if(this.href.length){
121 cfg.href = this.href;
124 var cn = cfg.cn[0].cn;
126 if(this.title.length){
129 cls: 'masonry-brick-title',
134 if(this.html.length){
137 cls: 'masonry-brick-text',
142 if(this.bgimage.length){
145 cls: 'masonry-brick-image-view',
154 initEvents: function()
197 this.el.on('touchstart', this.onTouchStart, this);
198 this.el.on('touchmove', this.onTouchMove, this);
199 this.el.on('touchend', this.onTouchEnd, this);
201 this.el.on('mouseenter' ,this.enter, this);
202 this.el.on('mouseleave', this.leave, this);
205 if (typeof(this.parent().bricks) == 'object' && this.parent().bricks != null) {
206 this.parent().bricks.push(this);
211 onClick: function(e, el)
219 var time = this.endTimer - this.startTimer;
230 enter: function(e, el)
234 if(this.bgimage.length && this.html.length){
235 this.el.select('.masonry-brick-paragraph', true).first().setOpacity(0.9, true);
239 leave: function(e, el)
243 if(this.bgimage.length && this.html.length){
244 this.el.select('.masonry-brick-paragraph', true).first().setOpacity(0, true);
248 onTouchStart: function(e, el)
250 // e.preventDefault();
252 if(!this.bgimage.length || !this.html.length){
256 this.el.select('.masonry-brick-paragraph', true).first().setOpacity(0.9, true);
258 this.timer = new Date().getTime();
260 this.touchmoved = false;
263 onTouchMove: function(e, el)
265 this.touchmoved = true;
268 onTouchEnd: function(e, el)
270 // e.preventDefault();
272 if((new Date().getTime() - this.timer > 1000) || !this.href.length || this.touchmoved){
279 if(!this.bgimage.length || !this.html.length){
281 if(this.href.length){
282 window.location.href = this.href;
288 this.el.select('.masonry-brick-paragraph', true).first().setOpacity(0, true);
290 window.location.href = this.href;