1
jquery없이 Ionic에서 어떻게 할 수 있습니까?ionic 2 - 윈도우 가져 오기. 스크롤 바로 가기
var window_top = jQuery(window).scrollTop() + 56;
var div_top = jQuery('#sticky-anchor').offset().top;
jquery없이 Ionic에서 어떻게 할 수 있습니까?ionic 2 - 윈도우 가져 오기. 스크롤 바로 가기
var window_top = jQuery(window).scrollTop() + 56;
var div_top = jQuery('#sticky-anchor').offset().top;
당신은 Content
에 대한 참조를 사용할 수 있습니다
import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';
@Component({...})
export class MyPage{
@ViewChild(Content) content: Content;
scrollToTop() {
this.content.scrollToTop();
}
scrollTo(elementId:string) {
let yOffset = document.getElementById(elementId).offsetTop;
this.content.scrollTo(0, yOffset, 4000)
}
}
사용할 수있는 특성이 많이있다; 가장 큰 수입품 중 하나는 ...
getContentDimensions()
: 요소 및 치수를 반환합니다.
Property Type Details
dimensions.contentHeight number content offsetHeight
dimensions.contentTop number content offsetTop
dimensions.contentBottom number content offsetTop+offsetHeight
dimensions.contentWidth number content offsetWidth
dimensions.contentLeft number content offsetLeft
dimensions.contentRight number content offsetLeft + offsetWidth
dimensions.scrollHeight number scroll scrollHeight
dimensions.scrollTop number scroll scrollTop
dimensions.scrollBottom number scroll scrollTop + scrollHeight
dimensions.scrollWidth number scroll scrollWidth
dimensions.scrollLeft number scroll scrollLeft
dimensions.scrollRight number scroll scrollLeft + scrollWidth
어디에서이 문제를 해결할 수 있습니까? – sebaferreras
@sebaferreras 아니요. 나는 jquery를 사용하여 끝내지 않았습니다. –