简体   繁体   English

CSS,jQuery和JavaScript在iPhone iPad上无法正常工作

[英]CSS, jQuery and JavaScript not working properly on iPhone iPad

I just finished programing my own website, i uploaded it to my hosting on GoDaddy, is looking good on computers and on my android phone BUT on the iPhone and the iPad everything is wrong. 我刚刚完成自己的网站的编程,将其上传到GoDaddy上的主机上,在计算机上以及在iPhone和iPad上的Android手机上看起来不错,但一切都不对。 I have some parallax effects, fixed backgrounds and a menu that goes up and get fixed position when getting to the top of the viewport, nothing of that works on these devices. 我有一些视差效果,固定的背景以及一个菜单,该菜单在到达视口顶部时会上升并固定在一个位置上,而这些设备都无法使用。

The scroll seams to be the biggest problem, i have a lot of things that moves or do something as you scroll the page down, all of these effect just applied when the smooth scroll stops, i read something about scroll momentum on IOs devices and this: 滚动接缝是最大的问题,当您向下滚动页面时,我有很多东西会移动或执行某些操作,所有这些效果仅在平滑滚动停止时才起作用,我在IO设备上了解了一些有关滚动动量的信息, :

   overflow-y: scroll;
  -webkit-overflow-scrolling: touch;

Is there some meta tags, pre-fixes i don't know about? 有一些我不知道的元标记和前缀吗? I just can't make this work, thanks in advance. 谢谢,我只是无法完成这项工作。

The problem is that IOs devices turn off all the movement functions to achieve that smooth scroll that iPhone and iPads have when you navigate a website. 问题在于,IOs设备会关闭所有移动功能,以实现在浏览网站时iPhone和iPad具有的平滑滚动。

The best solution I found for this is: http://markdalgleish.com/projects/stellar.js/demos/ 我为此找到的最佳解决方案是: http : //markdalgleish.com/projects/stellar.js/demos/

The other option is to detect if the user agent is on a iPhone or iPad and change the css styles to the objects with the parallax or other transition effects with this jQuery: 另一个选项是检测用户代理是否在iPhone或iPad上,并使用此jQuery将css样式更改为具有视差或其他过渡效果的对象:

Js s

var userAgent = window.navigator.userAgent;
if (userAgent.match(/iPad/i) || userAgent.match(/iPhone/i)) {
    $('#banner').addClass('ios-background');
}

Css 的CSS

.ios-background{
    backgorund-attachment: scroll
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM