當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Renderer2.setStyle方法代碼示例

本文整理匯總了TypeScript中@angular/core.Renderer2.setStyle方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Renderer2.setStyle方法的具體用法?TypeScript Renderer2.setStyle怎麽用?TypeScript Renderer2.setStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/core.Renderer2的用法示例。


在下文中一共展示了Renderer2.setStyle方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: _onDragend

    _onDragend(event){

        this._ox = event.clientX - this._cx + this._elementRef.nativeElement.offsetLeft;
        this._oy = event.clientY - this._cy + this._elementRef.nativeElement.offsetTop;
        this._renderer.setStyle(this._elementRef.nativeElement, 'left', this._ox + 'px');
        this._renderer.setStyle(this._elementRef.nativeElement, 'top', this._oy + 'px');
    }
開發者ID:jiw0220,項目名稱:jigsaw,代碼行數:7,代碼來源:draggable.ts

示例2: _setStyles

  /**
   * Sets the proper styles to the ink bar element.
   * @param element
   */
  private _setStyles(element: HTMLElement) {
    const left = element ? (element.offsetLeft || 0) + 'px' : '0';
    const width = element ? (element.offsetWidth || 0) + 'px' : '0';

    this._renderer.setStyle(this._elementRef.nativeElement, 'left', left);
    this._renderer.setStyle(this._elementRef.nativeElement, 'width', width);
  }
開發者ID:GuzmanPI,項目名稱:material2,代碼行數:11,代碼來源:ink-bar.ts

示例3: performTransition

    private performTransition():void {
        if (!this._isReady || this._isAnimating || !this._queueFirst) {
            // Don't transition until we are ready, or if we are animating, or if there aren't any transitions in the queue.
            return;
        }

        this._isAnimating = true;

        const transition = this._queueFirst;

        // Set the Semantic UI classes for transitioning.
        transition.classes.forEach(c => this._renderer.addClass(this._element, c));
        this._renderer.addClass(this._element, `animating`);
        this._renderer.addClass(this._element, transition.directionClass);

        // Set the Semantic UI styles for transitioning.
        this._renderer.setStyle(this._element, `animationDuration`, `${transition.duration}ms`);
        this._renderer.setStyle(this._element, `display`, this._display);

        if (transition.direction === TransitionDirection.In) {
            // Unset hidden if we are transitioning in.
            this._isHidden = false;
        }

        // Wait the length of the animation before calling the complete callback.
        this._animationTimeout = window.setTimeout(() => this.finishTransition(transition), transition.duration);
    }
開發者ID:edcarroll,項目名稱:ng2-semantic-ui,代碼行數:27,代碼來源:transition-controller.ts

示例4: clearCellPosition

 clearCellPosition(renderer: Renderer2, el: any): void {
   if (this.gridster.$options.useTransformPositioning) {
     renderer.setStyle(el, 'transform', '');
   } else {
     renderer.setStyle(el, 'top', '');
     renderer.setStyle(el, 'left', '');
   }
 }
開發者ID:wuranium,項目名稱:angular-gridster2,代碼行數:8,代碼來源:gridsterRenderer.service.ts

示例5: show

 public show(appendToBody: boolean): void {
     this.appendToBody = appendToBody;
     this.renderer.setStyle(this.element.nativeElement, 'display', 'block');
     this.renderer.setStyle(this.element.nativeElement, 'visibility', 'visible');
     this.isVisible = true;
     if (appendToBody) {
         window.addEventListener('scroll', this.scrollHandler);
     }
 }
開發者ID:MagicAardvark,項目名稱:novo-elements,代碼行數:9,代碼來源:PickerContainer.ts

示例6: setCellPosition

 setCellPosition(renderer: Renderer2, el: any, x: number, y: number): void {
   if (this.gridster.$options.useTransformPositioning) {
     const transform = 'translate3d(' + x + 'px, ' + y + 'px, 0)';
     renderer.setStyle(el, 'transform', transform);
   } else {
     renderer.setStyle(el, 'left', this.getLeftMargin() + x + 'px');
     renderer.setStyle(el, 'top', this.getTopMargin() + y + 'px');
   }
 }
開發者ID:wuranium,項目名稱:angular-gridster2,代碼行數:9,代碼來源:gridsterRenderer.service.ts

示例7: ngAfterViewInit

   ngAfterViewInit() {
     if (this.isBrowser()) {
       const nativeElement = this.el.nativeElement;
       const options = this.cloudinary.toCloudinaryAttributes(nativeElement.attributes, this.transformations);
       const imageUrl = this.cloudinary.url(this.clBackgroundImage, options);
       this.renderer.setStyle(nativeElement, 'background-image', `url('${imageUrl}')`);
       this.renderer.setStyle(nativeElement, 'background-repeat', 'no-repeat');
       this.renderer.setStyle(nativeElement, 'background-position', 'center');
     }
 }
開發者ID:RTLcoil,項目名稱:cloudinary_angular,代碼行數:10,代碼來源:cloudinary-background-image.directive.ts

示例8: ngDoCheck

 ngDoCheck() {
     if (this.isVisible && this.position) {
         const element = this.element.nativeElement;
         const position = Helpers.calcPositionOffset(this.position, element, this.side);
         if (position) {
             this.renderer.setStyle(element, 'top', position.top);
             this.renderer.setStyle(element, 'left', position.left);
             this.renderer.setStyle(element, 'width', position.width);
         }
     }
 }
開發者ID:MagicAardvark,項目名稱:novo-elements,代碼行數:11,代碼來源:PickerContainer.ts

示例9: checkRoleAccess

 private checkRoleAccess(featureEnabled: boolean) {
   const hasRoleAccess = this.authService.securityInfo.canAccess(this.dataflowAppRoles);
   if (!featureEnabled || !hasRoleAccess) {
     this.renderer.setStyle(this.elem.nativeElement, 'display', 'none');
   } else {
     if (this.existingDisplayPropertyValue) {
       this.renderer.setStyle(this.elem.nativeElement, 'display', this.existingDisplayPropertyValue);
     } else {
       this.renderer.removeStyle(this.elem.nativeElement, 'display');
     }
   }
 }
開發者ID:BoykoAlex,項目名稱:spring-cloud-dataflow-ui,代碼行數:12,代碼來源:roles.directive.ts

示例10: updateWithVisibleChange

 updateWithVisibleChange(): void {
   // update modal
   if (this.cacheModalElement) {
     // this.cacheModalElement.innerHTML = this.makeModalTmp(this.visible)
     this.renderer.setStyle(this.cacheModalElement, 'display', this.visible ? 'block' : 'none')
   }
   // lock body scroll
   if (this.lockScroll) {
     const nextValue = this.visible ? 'hidden' : this.cacheOverflow
     this.renderer.setStyle(this.document.body, 'overflow', nextValue)
   }
 }
開發者ID:weiwang94,項目名稱:element-angular,代碼行數:12,代碼來源:dialog.ts


注:本文中的@angular/core.Renderer2.setStyle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。