Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery iOs跳转包含输入的固定页脚_Jquery_Html_Ios_Css_Cordova - Fatal编程技术网

Jquery iOs跳转包含输入的固定页脚

Jquery iOs跳转包含输入的固定页脚,jquery,html,ios,css,cordova,Jquery,Html,Ios,Css,Cordova,我有一个phoneGap cordova应用程序。其中我有一个页面,有固定的页脚用于输入,但每当手机中打开软键键盘时,固定元素就会松开其位置并向上跳跃 我已经看到了很多相同的解决方案,但没有运气 以下是我的页面css: .main { display: table; border-spacing:0px; margin-top:10px; margin-left: 18px; margin-right: 10px; height: auto; } .imageIc

我有一个phoneGap cordova应用程序。其中我有一个页面,有固定的页脚用于输入,但每当手机中打开软键键盘时,固定元素就会松开其位置并向上跳跃

我已经看到了很多相同的解决方案,但没有运气

以下是我的页面css:

.main {
  display: table;
  border-spacing:0px;
  margin-top:10px;
  margin-left: 18px;
  margin-right: 10px;
  height: auto;
   }

.imageIcon {
  display: table-cell;
  vertical-align:top;
  cursor: pointer;
}
.contentDiv {
  display: table-cell;
  vertical-align: middle;
  padding-left:12px;
  width:100%;
}
.nameAndId {
  /* background-color: aqua; */
  margin-top:6px;
  font-family: Roboto-medium;
  font-size: 13px;
}
.commentDetails {
    margin-top: 5px;
    font-size: 12px;
    word-break: break-word;
}
.ID
{
    font-size: 12px;
    display:inline;
}
.updateTime {
  float: right;
  margin-top: 16px;
  font-family: Roboto-light;
    font-size: 12px;
  color:#767676;
}

.footerClass
{   background:#ffffff;
    position:device-fixed; 
    bottom:0px;
    padding: 16px 0px;  
    width:100%;
    display:-webkit-box;
    -webkit-box-orient:horizontal;
    }

.cameraImage
{

    width:initial;
    margin-left: 18px;
    cursor: pointer;


}

.inputComment
{

    margin-left: 10px;
    -webkit-box-flex:1;
    margin-right:10px;
    padding-right:10px;
}

.inputCommentTextBox
{
    width:100%;
    outline: 0;
    border-left:0px;
    border-right:0px;
    border-top:0px;
    border-bottom-width: 1px;
    border-bottom-color:#767676;
    background-color: transparent;
    border-bottom-left-radius:5px;
    border-bottom-right-radius:5px;

}

.postImage
{

    width:initial;
    cursor: pointer;
    margin-right: 10px;


}
HTML:

<div id="mainComment" style="background-color:#ffffff; height:auto;padding-top:1px; padding: 1px 0px 20px;overflow-x:hidden;" >
    <div style="background-color:#ededed;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;">
        <div style="-webkit-box-flex:1;-webkit-flex:1 100%;-ms-flex:1 100%;flex:1 100%;text-align: center;-webkit-align-self: center;-ms-flex-item-align: center;align-self: center;padding-top:4px;padding-left: 20px;">Comments</div>
        <div class="cameraImage showPen"><img data-ng-click="returnBack()" style="width: 35px;height: 35px;padding: 10px;" src="close.png" alt="Camera Image"/></div>
    </div>

    <div data-ng-repeat="name in names" >

        <div  class="main" style="background:#ffffff;padding: 10px;">
            <div class="imageIcon"><img style="height:56px;width:56px;"src="user.png" alt="UserMale" /></div>
            <div class="contentDiv">        
                    <div class="nameAndId">{{name}},<p class="ID"> {{xyz}}</p></div>
                    <div class="commentDetails">{{abc}}</div>
                    <div class="updateTime timeago" title="" >{{yzk}} ago</div>
            </div>
        </div>
        </div>

    <div id="footerId" class="footerClass" >
            <div class="cameraImage showPen" data-ng-show="false"><img data-ng-click="returnBack()" style="width:20px;height:20px;" src="close.png" alt="Camera Image"/></div>
            <div class="inputComment"><input onfocus="this.value = this.value;" id="commentBox" data-ng-model="commentData" type="text" placeholder="Write your Comment" class="inputCommentTextBox"></div>  
            <div class="postImage"  data-ng-show='postSelector'><img  style="width:26px;height:22px;" src="send.png" alt="Search Image"/></div>
            <div class="postImage" data-ng-show='loadMoreContentComment'>

            </div>
    </div>
</div>
所以,每当我把焦点放在固定的页脚的输入上时,它就会从它的位置移向上

请给我建议解决方案,因为我已经经历了很多解决方案,但还没有运气

谢谢你试试这个

$("input").on("focus", function(event){
    if(event.handled !== true)
    {
        $(".footerClass").css({ 'position': 'absolute' });
        $(".footerClass").css('display', 'none');        
    }
    return false;
});

$("input").on("blur", function(event){
   if(event.handled !== true)
   {        
      if(!$("input").is(":focus")){
          $(".footerClass").css({ 'position': 'fixed' })
          $(".footerClass").css('display', 'block');           
      }
   }
   return false;
});

设备修好了吗?试着像那样使用固定的和普通的HTML语句。@Sithys你能确切地告诉我如何使用它吗,因为当我尝试使用它作为position:devicefixed;这对我不起作用。这似乎也是iOS Chrome的一个问题。但这并不一致。与元素交互后,行为将发生变化,浮动元素将停止移动。至少对我来说是这样。将位置设置为“绝对”似乎并没有解决问题。