2015-11-01 209 views
2

我有一個CSGO賭博網站,我想,在鍋中顯示當前項目中在滾動條水平DIV所有我所做的是滾動條水平DIV

enter image description here

這裏是它的代碼:

<?php 
@include_once('set.php'); 
@include_once('steamauth/steamauth.php'); 
@include_once "langdoc.php"; 
$lang = $_COOKIE["lang"]; 

$gamenum = fetchinfo("value","info","name","current_game"); 
if(!isset($_SESSION["steamid"])) $admin = 0; 
else $admin = fetchinfo("admin","users","steamid",$_SESSION["steamid"]); 
$ls2=0; 
//$rs69 = mysql_query("SELECT * FROM `game".$gamenum."` GROUP BY `userid` ORDER BY `id` DESC"); 
$rs69 = mysql_query("SELECT * FROM `game25` GROUP BY `userid` ORDER BY `id` DESC");?> 
<?php if(mysql_num_rows($rs69) == 0): ?> 
<?php else: ?> 
    <?php $row69 = mysql_fetch_array($rs69); ?> 
     <?php 
     if(!empty($row69['userid'])): 
     $ls2++; 
     $avatar = $row69["avatar"]; 
     $userid = $row69["userid"]; 
     $username = fetchinfo("name", "users", "steamid", $userid); 
     $usn = '"item" title="'.$username.'"'; 
     $steamid = fetchinfo("steamid", "users", "steamid", $userid); 
     $rs2 = mysql_query("SELECT SUM(value) AS value FROM `game".$gamenum."` WHERE `userid`='$userid'"); 
     $row = mysql_fetch_assoc($rs2); 
     $sumvalue = $row69["value"]; 
     ?> 

<?php //item stuff 
     //$rs322=mysql_query("SELECT * FROM `game".$gamenum."` WHERE `userid`='$userid' ORDER BY `value` DESC "); 
     //$rs322=mysql_query("SELECT * FROM `game25` ORDER BY `value` DESC "); 
     $rs322=mysql_query("SELECT * FROM `game".$gamenum."` ORDER BY `value` DESC "); 
     while ($row699 = mysql_fetch_array($rs322)): 
     $imglnk = 'http://steamcommunity-a.akamaihd.net/economy/image/'.$row699["image"].'/70fx58f'; 
     $wepprice = $row699['value']; 
     $weppname = $row699['item']; 
     $height="0"; 
     $ipx="px;"; 
     $heipx = $height.' '.$ipx; 
?> 
     <div class = "itemsdrop"> 
     <div class ="dropitems"> 
     <img src=<?php echo $imglnk; ?> class="mCS_img_loaded"> 
     </div> 
     <div class="col-lg-11 desc"> 
     <span class ="number hide"></span> 
     </div> 
     </div> 
     </div> 
     <?php $height = $height + "15"; ?> 
     <?php 
     endwhile; 
     endif; //end if(!empty...) 
     endif; 

     ?> 

CSS:

.itemsdrop { 
    background:#fff; 
    float:left; 
    position:relative; 
} 

.dropitems { 
    overflow:hidden; 
    overflow-x:scroll; 
} 

有誰可以幫我嗎?這將是很好的得到這個工作。

+3

你的代碼段需要html,而不是php,爲了顯示你的問題 –

回答

0

Here's水平滾動的一個簡單示例。

基本上,你需要分配下列屬性外()元素(在你的情況,我認爲這將是.itemsdrop):

white-space: nowrap; 
overflow-x: scroll; 

這將允許內的元素滾動水平。

您的代碼的問題是您要爲每個框添加水平滾動,而不是父元素。

+0

這是一個關於該div的新圖片:[link](http://i.imgur.com/3V9HTBU.png) – OwnarDoz

+0

請參閱我已編輯的答案@OwnarDoz。 –

+0

如何將它添加到只有一個盒子?我對CSS不太好。 – OwnarDoz