向下滚动时可调整大小停止工作

时间:2017-02-24 13:21:13

标签: javascript jquery html css

我有一个可滚动的div,可以在底部调整大小:

using (SqlConnection Connection = new SqlConnection(@"Data Source=EWOODWARD-PC\SQL2012; Initial Catalog=CustomerGUI; Integrated Security=True"))
{
    using (SqlCommand cmd = Connection.CreateCommand())
    {

        cmd.CommandText = "UPDATE tblCustomerInformation SET LastName = @ln, Email = @em WHERE FirstName = @fn";

        cmd.Parameters.AddWithValue("@ln", txtLastName.Text);
        cmd.Parameters.AddWithValue("@em", txtEmail.Text);
        cmd.Parameters.AddWithValue("@fn", txtFirstName.Text);

        Connection.Open();

        cmd.ExecuteNonQuery();
    }
}

它可以工作,但只有当它完全滚动到顶部时才会起作用:

enter image description here

向下滚动时,可调整大小的功能似乎停止工作:

enter image description here

Here is a fiddle

2 个答案:

答案 0 :(得分:3)

我玩过它并找到了解决方案(希望如此)。我将.resizable()放在容器div中,如下所示,所有内容似乎都在this fiddle中。代码:

HTML:

<div id="resizeContainer">

  <div id="mydiv" class="ui-widget-content">
    <img src="https://cdn3.iconfinder.com/data/icons/car-icons-front-views/480/Sports_Car_Front_View-512.png" width="400">
  </div>

</div>

使用Javascript:

$("#resizeContainer").resizable({
  handles: "s",
});

CSS:

#resizeContainer { 
  height: 200px; 
  overflow:hidden; 
  padding-bottom: 20px; 
  padding-right: 20px; 
}  

#mydiv {
  height: 100%;
  width: 100%;
  border-bottom: 3px solid red;
  padding: 0.5em;
  overflow: auto;
}

答案 1 :(得分:0)

添加此修复程序:

$("#mydiv").on("resize", function(){
    $("#mydiv").resizable({
        handles: "s",
    });
});