mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
Fixie stickie
This commit is contained in:
@ -9,8 +9,6 @@ import {ScrollTo} from '../../animations/scroll-to';
|
|||||||
import {FeatureDetect} from '../../util/feature-detect';
|
import {FeatureDetect} from '../../util/feature-detect';
|
||||||
import {StickyPoly} from './sticky-poly';
|
import {StickyPoly} from './sticky-poly';
|
||||||
|
|
||||||
console.log(StickyPoly);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Content component provides an easy to use content area that can be configured to use Ionic's custom Scroll View, or the built in overflow scrolling of the browser.
|
* The Content component provides an easy to use content area that can be configured to use Ionic's custom Scroll View, or the built in overflow scrolling of the browser.
|
||||||
*
|
*
|
||||||
@ -63,9 +61,7 @@ export class Content extends Ion {
|
|||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if(!this.featureDetect.has('sticky')) {
|
if(!this.featureDetect.has('sticky')) {
|
||||||
console.log('Enabling sticky polyfill');
|
|
||||||
this._sticky = StickyPoly(this.scrollElement);
|
this._sticky = StickyPoly(this.scrollElement);
|
||||||
//this._sticky.init();
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,33 +0,0 @@
|
|||||||
import {Content} from './content';
|
|
||||||
|
|
||||||
export class StickyPolyfill {
|
|
||||||
constructor(private content: Content) {
|
|
||||||
this._els = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
init() {
|
|
||||||
let handleScroll = (event) => {
|
|
||||||
let t = event.target;
|
|
||||||
let top = t.scrollTop;
|
|
||||||
console.log(top);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
this._scrollListener = this.content.addScrollEventListener(handleScroll);
|
|
||||||
}
|
|
||||||
onDestroy() {
|
|
||||||
if(this._scrollListener) {
|
|
||||||
// Remove the old listener
|
|
||||||
this._scrollListener();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
add(element: Element) {
|
|
||||||
this._els.push(this.initElement(element))
|
|
||||||
}
|
|
||||||
|
|
||||||
remove(element: Element) {
|
|
||||||
}
|
|
||||||
|
|
||||||
initElement(element) {
|
|
||||||
}
|
|
||||||
}
|
|
@ -44,7 +44,9 @@ export class ItemGroupTitle {
|
|||||||
}
|
}
|
||||||
onInit() {
|
onInit() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
if(this.content.getStickyPolyfill()) {
|
||||||
this.content.getStickyPolyfill().add(this.elementRef.nativeElement);
|
this.content.getStickyPolyfill().add(this.elementRef.nativeElement);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user