问题
I have been developing a website for mobile devices. However due to some reasons, AJAX calls are not working on Opera Mini. For Example - one such request for loading more content at the end of page (70%)
$(document).scroll(function (e) {
if (processing) return false;
if ($(window).scrollTop() >= ($(document).height() - $(window).height()) * 0.7) {
processing = true;
$.ajax({
type: "GET",
url: "/ajax/popup-loadmore-test.php",
data: {
entityid: $("#e").attr("data-id"),
version: version
}
}).done(function (msg) {
console.log("Data emitted: " + msg);
$('#f').append(msg);
version++;
processing = false;
});
}
});
It is working everywhere, on desktop, on UC browser, android browser etc but not Opera Mini.
Please help if AJAX is written in some different way for Opera Mini. I have been reading a lot about the way Opera Mini renders page on browser. My user base has almost 50% opera users so thats a big problem for me. Thanks.
回答1:
There is no scroll
event in Opera Mini.
Unsupported DOM events for Opera Mini:
- contextmenu
- dblclick
- error
- keydown
- keypress
- keyup
- mousemove
- mouseenter
- mouseleave
- mouseout
- mousewheel
- resize
- scroll
- touchcancel
- touchend
- touchmove
- touchstart
Read more how Opera Mini works.
回答2:
as scroll
event not supported by opera mini use button as load more and add onClick
event to that button, opera mini support onClick event
<div id="loadmore" onClick="loadmore()">More</div>
function loadmore()
{
$.ajax({
type: "GET",
url: "/ajax/popup-loadmore-test.php",
data: {
entityid: $("#e").attr("data-id"),
version: version
}
}).done(function (msg) {
console.log("Data emitted: " + msg);
$('#f').append(msg);
version++;
processing = false;
});
}
来源:https://stackoverflow.com/questions/27186284/opera-mini-jquery-ajax-not-loading