- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是设计新手所以我正在制作一个聊天框但是当在框中填充值后它 div 上升,如何使该 div 向下滚动我尝试了来自互联网的所有解决方案但没有一个有效,所以我有两个问题 div 滚动应该在底部并且 div 刷新 2 秒这是代码
<div class="col-sm-3 col-sm-offset-4 frame" style='margin-top:-8px;' id='huge'>
<ul id="mylist" stye="">
<?php
$conn = new PDO("mysql:host=localhost;dbname=chatbox",'root');
$stmt = $conn->prepare("select * from chatbox order by created");
$stmt->execute();
if($stmt->rowCount() > 0)
{
while($row = $stmt->fetch(PDO::FETCH_ASSOC))
{
if($_SESSION['username']==$row['user_name']){
?>
<li style="width:100%" id="bottom">
<div class="msj macro">
<div class="avatar"><img class="img-circle" style="width:100%;" src="img/unknown.png" /></div>
<div class="text text-l" id="">
<p>
<?php echo $row['msg']; ?>
</p>
<p><small><?php echo date('H:i', strtotime($row['created']));?></small></p>
</div>
</div>
</li>
<?php }else{ ?>
<li style="width:100%; color:white;" id="myid">
<div class="msj-rta macro">
<div class="text text-r">
<p>
<?php echo $row['msg']; ?>
</p>
<p><small><?php echo date('H:i', strtotime($row['created']));?></small></p>
</div>
<div class="avatar" style="padding:0px 0px 0px 10px !important">
<img class="img-circle" style="width:100%;" src="img/unknown.png" /></div>
</li>
<?php
}}}
?>
</ul>
<div>
<form role='insert'>
<input type='hidden' class="mytext" name='user_name' id='user_name' value="<?php echo $_SESSION['username'] ?>" />
<div class="msj-rta macro" style='margin-right:30px;margin-bottom:-40px;'>
<div class="text text-r" style="background:whitesmoke !important;">
<input class="mytext" placeholder="Type a message" name='msg' id='msg' />
</div>
</div>
<div style="padding-left:240px;margin-bottom:20px;">
<button type="submit" class="login-button" id='submit'><i class="fa fa-chevron-right"></i></button>
</div>
</form>
</div>
</div>
</body>
<script>
$(document).ready(function() {
$("#submit").click(function() {
var user_name = $("#user_name").val();
var msg = $("#msg").val();
if (msg == '' || msg == '') {
alert("Please Fill All Fields");
} else {
$.ajax({
type: "POST",
url: "user/chatInsert.php",
data: 'user_name=' + user_name + '&msg=' + msg,
cache: false,
success: function(result) {
window.location.reload();
}
});
}
return false;
});
});
我尝试了所有可能的代码来影响我的代码,但没有一个有效,所以请尝试帮助我。
最佳答案
我不确定您在问什么,但根据您的标题,这就是使 block 可滚动的方式。
.scrollable {
overflow: auto;
height: 100px;
}
<div class="scrollable">
<ul>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
<li>this is a list</li>
</ul>
</div>
关于javascript - 如何使 div 内的 ul 标签可滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53170172/
我正在尝试使用 jQuery 来提交一个基本的 Accordion 样式菜单。 这是菜单: http://www.cybart.com/bscg/ 这是为其提供 Accordion 功能的代码片段:
这是我的网站: http://www.simply-a-christian.com/index.html 在导航栏上,如果您移动到: 信念 玛丽安教义 您可以看到每个 Marian Dogma(列出了
这可能是一个很容易回答的问题,但是,我找不到解决方案。我已经建立了一个非常简单的菜单,每当我将鼠标悬停在 ul 父项上时,它的子项 ul ul 就会变得可见。基本上它是有效的,但 parent 让位于
这是一张图片: 问题是(你可以看到):“页面”按钮太低,无法点击。我想要的是它应该靠近“联系人”。 现在是代码: HTML Home About
我有一个这样的嵌套 ul 列表: Subcat Subcat2
如果标题不好理解,我来解释一下... 我有一个 css/jquery 切换菜单。按“+”号时它变大,按“-”号时它变小。我使几个元素的填充、边距和高度在切换/单击时发生变化。菜单顶部充满了链接,然后当
我正在尝试创建一个列表,该列表会在单击上/下时更改它的第一个元素。 This is what i want to do. 此代码运行良好。但问题是我也在我网站的主菜单中使用列表,并且这段代码也在我的主
我需要使用水平缩放的 ul > li > ul 的组合来创建一个菜单。每个 ul 都应该有一个 max-height 并在溢出时滚动。悬停在 li 上时,如果里面有另一个 ul 标签,它应该会在右侧打
我正在 ul 中编写 ul 来制作 Accordion 式菜单。但是当我在 html 验证器中检查下面的代码时,它给了我这些错误 Element ul not allowed as child of
我有两个列表,第二个列表是可排序的,我可以从第一个列表拖动到第二个列表,但不知道如何从第一个列表中删除。 如果我删除 helper: "clone" ,该项目 (li) 会被删除,但拖放操作效果不佳(
JSFiddle 问题:https://jsfiddle.net/td6szj3o/ /我有一个 ul li,每个 li 都有标准文本项。该列表是动态的,因此有时每个内容 li 小于其所在容器的 wi
我有两个元素 - 一个在另一个里面。问题是第二个元素显示在第一个 ul li 元素的顶部。 HTML: Home Merchants
我有一些结构如下的菜单: First level link 1 Child link 1 Child link 2
我有很长的ul,李的数目不是恒定的 1 2 3 4 5 6 7 8 9 我想使用Moovweb SDK将其分为两个ul。 1 2 3 4
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎偏离主题,因为它缺乏足够的信息来诊断问题。 更详细地描述您的问题或 include a mini
我有一棵信息“树”,显示在许多嵌套列表中(ul li ul li ....)。两个问题: 当我点击时,父 ul 和子 ul 都会切换。 如果我点击在其中没有 ul 的嵌套列表中(例如,下面的 Cran
我正在尝试在 jQuery 中创建以下内容: 我有一个项目列表(例如 10 个)。如果项目数超过 6,则将剩余项目(从 6 到 10)复制到新的 UL 中以创建下拉菜单结构。 菜单的第一个版本是 ht
嘿大家 - 我在工作中尝试 jquery 的第二天,有点卡住了。 我有一个无序列表的链接..在无序列表的链接中 点击 ,我想要的 child 变得可见。 点击(文档上的任何位置)后,我想要 child
嗨,这就是我想要实现的目标。我有一个 ID="columns"的 div,在本例中我有 3 列,但可能会有更多或更少...我正在使用 JQuery 动态添加列表项。
这个问题已经有答案了: 已关闭10 年前。 Possible Duplicate: Using .after() to add html closing and open tags 我想显示高度几乎相
我是一名优秀的程序员,十分优秀!