2014-10-01 25 views
1

我一直在为ios创建salesforce 1移动应用的visualforce页面。 在滚动页面时,随着视口移动,按钮似乎不会被点击。ios中的Salesforce 1视口问题

有人可以提出任何事情吗?

谢谢

回答

1

您可以在任何一个下面的脚本在您的网页

  1. 添加以下JavaScript到您的网页:
<script> 
(function(){try{var a=navigator.userAgent;if((a.indexOf('Salesforce')!=-1)&&(a.indexOf('iPhone')!=-1||a.indexOf('iPad')!=-1)&&(a.indexOf('OS/8')!=-1||a.indexOf('OS 8')!=-1)&&(a.indexOf('Safari')==-1)){ 
var s=document.createElement('style'); 
s.innerHTML="html,html body{overflow: auto;-webkit-overflow-scrolling:touch;}body{position:absolute;left:0;right:0;top:0;bottom:0;}"; 
document.getElementsByTagName('head')[0].appendChild(s);}}catch(e){}})(); 
</script> 
  • 添加以下JavaScript到您的页面:
  • <script> 
    var ua=navigator.userAgent; 
    if((ua.indexOf('Salesforce')!=-1)&&(ua.indexOf('iPhone')!=-1||ua.indexOf('iPad')!=-1)&&(ua.indexOf('OS/8')!=-1||ua.indexOf('OS 8')!=-1)&&(ua.indexOf('Safari')==-1)){ 
    function IOS_SCROLL_BOOTSTRAP() { 
    var children = Array.prototype.slice.call(document.body.children), 
    placeholder = document.createElement('section'), 
    fragment = document.createDocumentFragment(), 
    styles, 
    width, 
    height; 
    children.forEach(function(c){fragment.appendChild(c);}); 
    placeholder.appendChild(fragment); 
    styles = [ 
    'width:100%;', 
    'height:', (window.screen.height - 42), 'px;', 
    'position: absolute; overflow: auto; -webkit-overflow-scrolling: touch' 
    ].join(''); 
    placeholder.style.cssText = styles; 
    document.body.appendChild(placeholder); 
    } 
    window.addEventListener('load', function (e) { 
    IOS_SCROLL_BOOTSTRAP(); 
    }); 
    } 
    </script> 
    
    +0

    欢迎来到StackOverflow!请记住,如果他们易于阅读,您将更有可能为有用的答案吸引高薪。这种代码缩进和格式化的方式使得很难遵循你正在做的事情。如果您不清楚如何格式化您的帖子,请阅读[Markdown编辑帮助](http://stackoverflow.com/editing-help)页面。 – JamesENL 2014-10-10 03:18:19