本文整理汇总了TypeScript中angular2/src/platform/browser/browser_adapter.BrowserDomAdapter.setStyle方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BrowserDomAdapter.setStyle方法的具体用法?TypeScript BrowserDomAdapter.setStyle怎么用?TypeScript BrowserDomAdapter.setStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/platform/browser/browser_adapter.BrowserDomAdapter
的用法示例。
在下文中一共展示了BrowserDomAdapter.setStyle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onMouseMove
onMouseMove( event )
{
let parentRect = this._dom.getBoundingClientRect( this._element.nativeElement );
let tooltipRect = this._dom.getBoundingClientRect( this._div );
let x:number;
let y:number;
if ( this.data.location === 'bottom' )
{
if ( this.data.offset )
{
x = event.clientX - parentRect.left - (tooltipRect.width / 2);
y = event.clientY - parentRect.top + 30;
}
else
{
x = event.clientX - (tooltipRect.width / 2);
y = event.clientY + 30;
}
}
else if ( this.data.location === 'right' )
{
if ( this.data.offset )
{
x = event.clientX - parentRect.left + 30;
y = event.clientY - parentRect.top - ( tooltipRect.height / 2 );
}
else
{
x = event.clientX + 30;
y = event.clientY - ( tooltipRect.height / 2 );
}
}
this._dom.setStyle( this._div, 'top', y + 'px' );
this._dom.setStyle( this._div, 'left', x + 'px' );
}
示例2: onMouseLeave
onMouseLeave( event )
{
this._dom.setStyle( this._div, 'display', 'none' );
}
示例3: onMouseEnter
onMouseEnter( event )
{
this._div = this._dom.createElement( 'div' );
this._dom.appendChild( this._element.nativeElement, this._div );
this._dom.setInnerHTML( this._div, this.data.tip );
this._dom.setStyle( this._div, 'display', 'block' );
this._dom.setStyle( this._div, 'font-size', '20px' );
this._dom.setStyle( this._div, 'font-weight', 'bold' );
this._dom.setStyle( this._div, 'position', 'absolute' );
this._dom.setStyle( this._div, 'background', '#262626' );
this._dom.setStyle( this._div, 'color', '#ccc' );
this._dom.setStyle( this._div, 'padding', '3px 12px' );
this._dom.setStyle( this._div, 'border', '1px solid #444' );
this._dom.setStyle( this._div, 'border-radius', '3px' );
this._dom.setStyle( this._div, 'box-shadow', '3px 3px 10px rgba(0, 0, 0, 0.5)' );
this._dom.setStyle( this._div, 'z-index', '1000' );
this._dom.setStyle( this._div, 'white-space', 'nowrap' );
}