本文整理匯總了TypeScript中@angular/platform-browser/src/browser/browser_adapter.BrowserDomAdapter.setStyle方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BrowserDomAdapter.setStyle方法的具體用法?TypeScript BrowserDomAdapter.setStyle怎麽用?TypeScript BrowserDomAdapter.setStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@angular/platform-browser/src/browser/browser_adapter.BrowserDomAdapter
的用法示例。
在下文中一共展示了BrowserDomAdapter.setStyle方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(elementRef:ElementRef, private dom:BrowserDomAdapter) {
this.$element = elementRef.nativeElement;
// initial styling
this.dom.setStyle(this.$element, 'position', 'absolute');
this.dom.setStyle(this.$element, 'top', '0');
this.dom.setStyle(this.$element, 'bottom', '0');
this.dom.setStyle(this.$element, 'max-height', '100%');
}
示例2: toggleMobileNav
toggleMobileNav() {
let dom = this.dom;
let $overflowParent = (this.options.$scrollParent === global) ? dom.defaultDoc().body
: this.$scrollParent;
if (dom.hasStyle(this.$resourcesNav, 'height')) {
dom.removeStyle(this.$resourcesNav, 'height');
dom.removeStyle($overflowParent, 'overflow-y');
} else {
let viewportHeight = this.options.$scrollParent.innerHeight
|| this.options.$scrollParent.clientHeight;
let height = viewportHeight - this.$mobileNav.getBoundingClientRect().bottom;
dom.setStyle($overflowParent, 'overflow-y', 'hidden');
dom.setStyle(this.$resourcesNav, 'height', height + 'px');
}
}
示例3: unstick
unstick() {
this.dom.setStyle(this.$element, 'position', 'absolute');
this.dom.setStyle(this.$element, 'top', '0');
}
示例4: stick
stick() {
this.dom.setStyle(this.$element, 'position', 'fixed');
this.dom.setStyle(this.$element, 'top', this.scrollYOffset() + 'px');
}