html.actionlink 锚点,页面内定位到锚点,总是出现闪屏的现象。返回的时候必须按两次,好像当前页面被额外打开了一次...

测试手机是三星S6,SM-G9208, android5.1.1

问题代码:document.location.href="#show_year";

整页代码如下:

所有课程

选择年份

var tmp_data = [{"CourseID":"01122","timeSegment":"08:00~10:00","OrgID":"0000001","OrgName":"海豚教育","CourseName":"高二物理1","bSubmited":1,"bConfirmed":1},{"CourseID":"01123","timeSegment":"10:00~12:00","OrgID":"0000002","OrgName":"优学教育","CourseName":"一对一王思聪","bSubmited":0,"bConfirmed":0}];

mui.init();

mui.plusReady(function() {

plus.webview.currentWebview().setStyle({

scrollIndicator: 'none'

});

(function($, doc) {

$.init();

$.ready(function() {

//普通示例

var userPicker = new $.PopPicker();

userPicker.setData([{

value: '2015',

text: '2015年'

}, {

value: '2016',

text: '2016年'

}, {

value: '2017',

text: '2017年'

}, {

value: '2018',

text: '2018年'

}, {

value: '2019',

text: '2019年'

}, {

value: '2020',

text: '2020年'

}]);

var showUserPickerButton = doc.getElementById('select_year');

//var userResult = doc.getElementById('userResult');

showUserPickerButton.addEventListener('tap', function(event) {

userPicker.show(function(items) {

//userResult.innerText = JSON.stringify(items[0]);

doc.getElementById('show_year').innerText = items[0].value;

document.location.href="#show_year";

//返回 false 可以阻止选择框的关闭

//return false;

});

}, false);

});

})(mui, document);

});

function saveData(date_str, server_data){

var myDate = new Date();

app.setStorageValue(date_str,'');

app.setStorageValue(date_str,JSON.stringify(server_data));

//记录最后的访问时间,以此判断是否需要从服务器重新获取数据

app.setStorageValue(date_str "_lastVisit",'');

app.setStorageValue(date_str "_lastVisit",myDate.getTime().toString());

};

//

//

// 08:00~10:00 海豚教育物理

//

//

10:00~12:00 优学教育英语

//

//

13:00~15:00 学大教育语文

//

//

function appendDate(value, content, data, obj){

//apend data

obj.innerHTML = '' content '';

var ul='

  • ';

for(var o in data) {

ul = '

ul = ' value="';

if(data[o].bSubmited == 1) {

ul = data[o].CourseID '|1">';

} else {

ul = data[o].CourseID '|0">';

}

ul = data[o].timeSegment " " data[o].OrgName data[o].CourseName;

ul = '

';

// alert(o ":" ul);

}

ul = '

';

// alert(ul);

// alert("brefor:" obj.innerHTML);

obj.innerHTML = ul;

// alert(obj.innerHTML);

};

var bSub_li = false;

mui("#month_list").on('tap','ul>li>ul>li a',function(){

bSub_li = true;

var value = this.getAttribute("value");

//传值给详情页面,通知加载新数据

var detailPage = null;

var index = value.indexOf("|1");

if(index > 0) {

var value_rel = value.substr(0,index);

detailPage = plus.webview.getWebviewById('submit');

//mui.fire(detailPage,'getDetail',{id:id});

mui.fire(detailPage,'courseID',{

id:value_rel

});

mui.openWindow({

id:'submit',

url:'submit.html',

show:{

aniShow:'none'

},

waiting:{

autoShow:false

}

});

} else {

index = value.indexOf("|0");

var value_rel = value.substr(0,index);

detailPage = plus.webview.getWebviewById('un_submit');

//mui.fire(detailPage,'getDetail',{id:id});

mui.fire(detailPage,'courseID',{

id:value_rel

});

mui.openWindow({

id:'un_submit',

url:'un_submit.html',

show:{

aniShow:'none'

},

waiting:{

autoShow:false

}

});

}

});

mui("#month_list").on('tap','ul>li a',function(){

if(bSub_li == true) {

bSub_li = false;

return;

}

var value = this.getAttribute("value");

var content = this.innerHTML;

var myDate = new Date();

//alert(document.getElementById("show_year").innerText);

var key_lastVisit = document.getElementById('show_year').innerText "_" value "_lastVisit";

var key = document.getElementById('show_year').innerText "_" value;

if(myDate.getTime() - app.getStorageValue(key_lastVisit)*1 > 5*50*1000) {

saveData(document.getElementById('show_year').innerText "_" value, tmp_data);

}

//alert(this.parentElement.innerHTML);

appendDate(value, content, JSON.parse(app.getStorageValue(key)), this.parentElement);

});

document.getElementById("search").addEventListener('tap',function(){

mui.openWindow({

url: '../consume/search.html',

id: 'search',

show: {

aniShow: 'pop-in'

},

waiting: {

autoShow: false

}

});

});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值