为什么javascript无法在手机或平板电脑上运行?但是,它当前在桌面上运行吗?
我知道这已经被问过了,但是找不到适合这种情况的答案
任何建议将不胜感激,谢谢
$(window).on('load', function() {
var pouch = $('.wrapperright'),
items = pouch.find('div'),
gate, spot = {},
zone = pouch.scrollTop(),
haze = 'opacity';
$(this).resize(collectInfo).resize();
pouch.scroll(function() {
items.each(function() {
var aim = $('#' + $(this).data('target')),
edges = this.getBoundingClientRect(),
apex = Math.round(edges.top),
nadir = Math.round(edges.bottom);
if (apex < gate && nadir > 0) aim.removeClass(haze);
else aim.addClass(haze);
});
var rise = $('.bio li').not('.' + haze),
turf = pouch.scrollTop();
if (rise.length > 1) {
if (turf > zone) rise.eq(0).addClass(haze);
else rise.eq(1).addClass(haze);
}
zone = turf;
});
$('.bio li').click(function() {
if (pouch.scrollTop() == spot[this.id]) return;
pouch.stop().animate({scrollTop: spot[this.id]}, 1500);
});
function collectInfo() {
gate = $(this).height();
items.each(function() {
spot[$(this).data('target')] =
Math.round($(this).position().top+pouch.scrollTop());
});
}
});
$('.up').click(function(){
$('.wrapperright').animate({scrollTop:0}, 'slow');
});