Commit 2318274a authored by prumde's avatar prumde

Created and use RESIZE_EVENT


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174422 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 558edc83
import { Component, OnInit, Input, ViewEncapsulation, OnChanges } from '@angular/core'; import { Component, OnInit, Input, ViewEncapsulation, OnChanges } from '@angular/core';
import { Observable } from 'rxjs/Observable'; import { RESIZE_EVENT } from '../ecm-store/ecm-resize';
import 'rxjs/add/observable/fromEvent';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/debounceTime';
import 'rxjs/add/operator/filter';
declare var reinitFlickity: any; declare var reinitFlickity: any;
...@@ -36,36 +32,16 @@ export class EcmCarouselComponent implements OnInit, OnChanges { ...@@ -36,36 +32,16 @@ export class EcmCarouselComponent implements OnInit, OnChanges {
console.log( "this.cardItems [" + this.cardItems + "]"); console.log( "this.cardItems [" + this.cardItems + "]");
} }
*/ */
const $resizeEvent = Observable.fromEvent(window, 'resize')
.map(() => {
return document.documentElement.clientWidth;
})
.debounceTime(200)
RESIZE_EVENT.subscribe(data => {
$resizeEvent.subscribe(data => { //console.log("data["+data+"]");
this.callUpdate( data );
console.log("data["+data+"]");
if( data > 1024 )
{
this.update(3);
}
else if( data < 1023 && data > 639 )
{
this.update(2);
}
else if( data < 640 )
{
this.update(1);
}
}); });
let data = document.documentElement.clientWidth;
this.firstCall(); this.callUpdate( data );
} }
firstCall() { callUpdate( data : any ) {
let data = document.documentElement.clientWidth;
if( data > 1024 ) if( data > 1024 )
{ {
this.update(3); this.update(3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment