当前位置: 首页>>代码示例>>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;未经允许,请勿转载。