标签:
混合式开发移动app,要实现的是初始化页面时不展示搜索框,让页面向上移动一定位移。
<ion-content class="has-subheader" start-y="38">
</ion-content>
可以实现。
应用js也能实现:
var cont = document.getElementsByTagName("ion-content")[0];
var start_top = 53;
var end_top = 88;
var slideShow = function(obj,start,end){
var start_top = $(obj).offset().top;
obj.addEventListener(‘touchstart‘, function(event) {
event.preventDefault();
if (event.targetTouches.length == 1) {
var touch = event.targetTouches[0];
start_top = touch.pageY;
}
});
obj.addEventListener(‘touchmove‘, function(event) {
event.preventDefault();
if (event.targetTouches.length == 1) {
var touch = event.targetTouches[0];
var top = parseFloat(touch.pageY - start_top);
if(top <= 35){
obj.style.top = String(top + start) + "px";
}else{
obj.style.top = end + "px";
}
}
});
}
slideShow(cont ,start_top ,end_top );
标签:
原文地址:http://www.cnblogs.com/hxb2015/p/4909541.html