|
 |
|
ถามการใช้ jquery lightbox ร่วมกับ การดึงรูปจาก php โดยการ วนลูป |
|
 |
|
|
 |
 |
|
Code (PHP)
<link rel="stylesheet" type="text/css" href="../style-projects-jquery.css" />
<!-- Arquivos utilizados pelo jQuery lightBox plugin -->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.5.css" media="screen" />
<!-- / fim dos arquivos utilizados pelo jQuery lightBox plugin -->
<!-- Ativando o jQuery lightBox plugin -->
<script type="text/javascript">
$(function() {
$('.zoom_pic').lightBox(); //+ เปลี่ยนตรงนี้ให้อ้างอิงจาก class
});
</script>
<style type="text/css">
/* jQuery lightBox plugin - Gallery style */
#gallery {
background-color: ;
padding: 0px;
}
#gallery div img {
border: 5px solid #C0C0C0;
border-width: 5px 5px 5px;
}
#gallery div a:hover img {
border: 5px solid #fff;
border-width: 5px 5px 5px;
color: #fff;
}
#gallery div a:hover {
color: #FFF;
}
</style>
</head>
<body topmargin="0">
<?PHP
include "conn.php";
$objDB = mysql_select_db("zubbsteel_group");
mysql_query("SET NAMES UTF8");
$sql = "SELECT PRO_ID as a,PRO_NAME as b,PRO_DES as c,PRO_PIC as d from products order by PRO_ORDERBY LIMIT 5";
$objQuery = mysql_query($sql) or die ("Error Query [".$sql."]");
$num_rows= mysql_num_rows($objQuery);
$i1=0;
while($num_rows>$i1){
$result=mysql_fetch_array($objQuery);
$a=$result['a'];
$b=$result['b'];
$c=$result['c'];
$d=$result['d'];
?>
<table width="514" border="1" cellpadding="0" cellspacing="0" bgcolor="#999999">
<tr>
<td width="100" id="gallery"><? echo "<a href=\"$d\" title=\"$b\" class=\"zoom_pic\"><img id=\"$a\" src=\"$d\" width=\"100\" height=\"100\" /></a>"; //+ เพิ่ม class zoom_pic ?></td>
<td valign="top" align="left" " width="414" style="font-family:Tahoma; font-size:12px; color:#333333"><? echo "<b>".$b."</b>"."<br /><br />".$c;?></td>
</tr>
<?
$i1++;
}
mysql_close();
?>
</table>
</body>
อ้างอิงจาก class แทนครับ
|
 |
 |
 |
 |
Date :
2012-08-24 16:09:28 |
By :
ไวยวิทย์ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สุดยอดดดดไปเลยคร๊าบบบ ได้แล้วคร๊าบบบ ผมเองก็คิดคอนเซ็ปประมาณนี้ แต่ไม่รู้ว่าจะใส่ค่าอะไรตรงไหนดี ขอบคุณท่าน นิโก้ อเนลก้า มา ณ ที่นี้ด้วยครับ ....
แล้วถ้า ผม include ไฟล์ แบบนี้ให้ไปอยู่ หน้า index (สมมติว่า มี 3 ไฟล์) ต้องแก้อะไรหรือเพิ่มอะไรไหมครับ กลัวว่าถ้าไปรวมกันอยู่หน้าเดียวจะแสดงแค่ตัวเดียวอีก ยังไงเด๋วลองมั่วก่อน ไม่ได้ยังไงมาถามอีกครับ ขอบคุณมากๆเลยครับ 
|
 |
 |
 |
 |
Date :
2012-08-24 16:26:32 |
By :
sikaju |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 04
|