这是我的问题我想使用滚动条但它只显示滚动条但滚动条不起作用。我正在使用CSS来设置滚动条和其他布局的样式,并使用Html来使用该样式。 这是我的造型代码
#sub_menu, #content{
display: inline-block;
}
#sub_menu{
width:23%;
height: 10%;
background-color: #999999;
padding: 1%;
vertical-align: top;
border: 1px solid;
}
#content{
width: 73%;
margin-right: 1%;
}
@media screen and (max-width: 600px), sreen\0{
#sub_menu{
height: initial;
font-size: 15px;
margin-bottom: 2%;
}
#content, #sub_menu{
display: block;
width: 95%
} }
.contentt {
height: 100%;
overflow-y: scroll;
margin-bottom: 1%;
}
.contentt::-webkit-scrollbar {
display: none;
}
这是我的HTML代码
<div id="sub_menu">
<h3 style="border-bottom: 3px solid rgb(135, 31, 139);">Related Videos</h3>
<div class="contentt" style="width:100%;height:40%; margin-bottom:3%;padding:2%" >
<?php
$con = new mysqli('localhost','','','');
$sql = "SELECT ID, Title, Link FROM that where Category like 'this'";
$result = $con->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$url = $row["Link"];
$title = $row["Title"];
$id = $row["ID"];
$path="http://domain/Song.php";
echo "<h5>$title'</h5>";
echo '<a href="' . $path . '?Title=' . $title .'&id=' . $id .'"><img src="http://domain/images/' . $id .'.jpg" alt="HTML tutorial" style="width:75%;height:95%;border:0;"class="btnn songpicc"></a>';
echo '<hr>';
}
} else {
echo "0 results";
}
$con->close();
?>
</div>
</div>
先谢谢
答案 0 :(得分:1)
您的滚动条无效或隐藏?
删除下面的CSS,它应该适合你
.contentt::-webkit-scrollbar {
display: none;
}
而是
.contentt {
overflow-y: scroll;
}
只需应用以下代码并检查
即可.contentt {
height: 400px;
overflow-y: auto;
}
答案 1 :(得分:1)
您需要使用overflow-y:scroll;
来修复容器的高度(不是以%为单位,而是以px或em为例)答案 2 :(得分:1)
只需删除以下css代码
即可using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TouchInput : MonoBehaviour {
public LayerMask touchInputMask;
private static List<GameObject> touchList = new List<GameObject>();
private GameObject[] touchesOld;
private RaycastHit hit;
void Update () {
#if UNITY_EDITOR
if(Input.GetMouseButton(0) || Input.GetMouseButtonDown(0) || Input.GetMouseButtonUp(0)){
touchesOld = new GameObject[touchList.Count];
touchList.CopyTo(touchesOld);
touchList.Clear();
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray, out hit, touchInputMask)){
GameObject recipient = hit.transform.gameObject;
touchList.Add(recipient);
if (Input.GetMouseButtonDown(0)){
recipient.SendMessage("OnTouchDown",hit.point,SendMessageOptions.DontRequireReceiver);
}
if (Input.GetMouseButtonUp(0)){
recipient.SendMessage("OnTouchUp",hit.point,SendMessageOptions.DontRequireReceiver);
}
if (Input.GetMouseButton(0)){
recipient.SendMessage("OnTouchStay",hit.point,SendMessageOptions.DontRequireReceiver);
}
}
foreach (GameObject g in touchesOld){
if (!touchList.Contains(g)){
g.SendMessage("OnTouchExit",hit.point,SendMessageOptions.DontRequireReceiver);
}
}
}
#endif
if (Input.touchCount > 0){
touchesOld = new GameObject[touchList.Count];
touchList.CopyTo(touchesOld);
touchList.Clear();
foreach (Touch touch in Input.touches){
Ray ray = Camera.main.ScreenPointToRay (touch.position);
//RaycastHit hit;
if (Physics.Raycast(ray, out hit, touchInputMask)){
GameObject recipient = hit.transform.gameObject;
touchList.Add(recipient);
if (touch.phase == TouchPhase.Began){
recipient.SendMessage("OnTouchDown",hit.point,SendMessageOptions.DontRequireReceiver);
}
if (touch.phase == TouchPhase.Ended){
recipient.SendMessage("OnTouchUp",hit.point,SendMessageOptions.DontRequireReceiver);
}
if (touch.phase == TouchPhase.Stationary || touch.phase == TouchPhase.Moved){
recipient.SendMessage("OnTouchStay",hit.point,SendMessageOptions.DontRequireReceiver);
}
if (touch.phase == TouchPhase.Canceled){
recipient.SendMessage("OnTouchExit",hit.point,SendMessageOptions.DontRequireReceiver);
}
}
}
foreach (GameObject g in touchesOld){
if (!touchList.Contains(g)){
g.SendMessage("OnTouchExit",hit.point,SendMessageOptions.DontRequireReceiver);
}
}
}
}
}
添加下面的css代码
.contentt::-webkit-scrollbar {
display: none;
}
如果您使用 .contentt {
overflow-y:auto;
height:/* give here height in px as you need */
}
,它会隐藏Chrome中的滚动条。但Firefox仍然存在默认滚动条。