我有一个文件recent.php,显示最近加入我网站的15位成员。由于15是一个很大的数字,我希望在页面上有一个滚动效果,以便所有最近的15个配置文件将继续滚动。然后我遇到SimplyScroll,但这是我面临的问题。 我下载了脚本并浏览了所有测试文件,如果我有静态图像,但是当有来自数据库的动态数据以html表的形式出现时,我已经理解了如何做到这一点(前15名已注册)成员和他们的个人资料。有人可以帮助我在哪里进行更改以获得滚动效果吗?这是recent.php的代码谢谢。
<?php
session_start()
include("connect/config.php");
if($_SESSION['gender123'])
{
if($_SESSION['gender123']=='Male')
{
$gender="where gender='Female'";
}
else
{
$gender="where gender='Male'";
}
}
$sql="select * from register $gender order by index_id DESC LIMIT 0,15";
$result=mysql_query($sql) or die(mysql_error());
$abcdef=$_SESSION['userid'];
$select="select * from payments where pmatri_id='$abcdef' or pemail='$abcdef'";
$exe=mysql_query($select) or die(mysql_error());
$fetch123=mysql_fetch_array($exe);
?>
<table width="210px" align="left" cellpadding="0" cellspacing="0" border="0" class="text2">
<tr valign="top">
<?php while($fetch=mysql_fetch_array($result)) { ?>
<td valign="top" align="left" height="55px" style="padding:1px; max-width:120px; min-width:120px;">
<?php if($_SESSION[ 'userid']) { if($fetch123[ 'profile']-$fetch123[ 'r_profile']>0) { ?>
<a href="memprofile.php?user_id=<?php echo $fetch['matri_id']; ?>">
<?php if($fetch[ 'photo1_approve']=="No" ) { ?>
<img src="images/No-Image-icon.png" height="100" width="90px" border="0" />
<?php } else if($fetch[ 'photo1']=='' ) { ?>
<img src="images/No-Image-icon.png" height="100" width="90px" border="0" />
<?php } else if($fetch[ 'photo_protect']=='Yes' ) { ?>
<img src="images/imagePassProtected.jpg" height="100" width="90px" border="0" />
<?php } else { ?>
<img src="photos/<?php echo $fetch['photo1']?>" height="100" width="90px" border="0" />
<?php } ?>
<br />
<h3><?php echo $fetch['firstname']." ".$fetch['lastname']; ?></h3>
</a>
</td>
<?php } ?>
</tr>
</table>
答案 0 :(得分:1)
它是一回事。无论是在桌子上还是在桌子外面。它始终是相同的程序。
(function($) {
$(function() { //on DOM ready
$(".scroller").simplyScroll({
orientation: 'horizontal',
auto: true,
manualMode: 'loop',
frameRate: 20,
speed: 5
});
});
})(jQuery);
&#13;
.simply-scroll-container {
/* Container DIV - automatically generated */
position: relative;
}
.simply-scroll-clip {
/* Clip DIV - automatically generated */
position: relative;
overflow: hidden;
}
.simply-scroll-list {
/* UL/OL/DIV - the element that simplyScroll is inited on */
overflow: hidden;
margin: 0;
padding: 0;
list-style: none;
}
.simply-scroll-list li {
padding: 0;
margin: 0;
list-style: none;
}
.simply-scroll-list li img {
border: none;
display: block;
}
.simply-scroll-btn {
position: absolute;
background-image: url(buttons.png);
width: 42px;
height: 44px;
z-index: 3;
cursor: pointer;
}
.simply-scroll-btn-left {
left: 6px;
bottom: 6px;
background-position: 0 -44px;
}
.simply-scroll-btn-left.disabled {
background-position: 0 0 !important;
}
.simply-scroll-btn-left:hover,
.simply-scroll-btn-left:focus {
background-position: 0 -88px;
}
.simply-scroll-btn-right {
right: 6px;
bottom: 6px;
background-position: -84px -44px;
}
.simply-scroll-btn-right.disabled {
background-position: -84px 0 !important;
}
.simply-scroll-btn-right:hover,
.simply-scroll-btn-right:focus {
background-position: -84px -88px;
}
.simply-scroll-btn-up {
right: 6px;
top: 6px;
background-position: -126px -44px;
}
.simply-scroll-btn-up.disabled {
background-position: -126px 0 !important;
}
.simply-scroll-btn-up:hover,
.simply-scroll-btn-up:focus {
background-position: -126px -88px;
}
.simply-scroll-btn-down {
right: 6px;
bottom: 6px;
background-position: -42px -44px;
}
.simply-scroll-btn-down.disabled {
background-position: -42px 0 !important;
}
.simply-scroll-btn-down:hover,
.simply-scroll-btn-down:focus {
background-position: -42px -88px;
}
.simply-scroll-btn-pause {
right: 6px;
bottom: 6px;
background-position: -168px -44px;
}
.simply-scroll-btn-pause:hover,
.simply-scroll-btn-pause:focus {
background-position: -168px -88px;
}
.simply-scroll-btn-pause.active {
background-position: -84px -44px;
}
.simply-scroll-btn-pause.active:hover,
.simply-scroll-btn-pause.active:focus {
background-position: -84px -88px;
}
/* Custom class modifications - override classees
.simply-scroll is default
*/
.simply-scroll {
/* Customisable base class for style override DIV */
width: 576px;
height: 200px;
margin-bottom: 1em;
}
.simply-scroll .simply-scroll-clip {
width: 576px;
height: 200px;
}
.simply-scroll .simply-scroll-list {} .simply-scroll .simply-scroll-list li {
float: left;
width: 290px;
height: 200px;
}
.simply-scroll .simply-scroll-list li img {} .simply-scroll .simply-scroll-btn {} .simply-scroll .simply-scroll-btn-left {} .simply-scroll .simply-scroll-btn-left.disabled {} .simply-scroll .simply-scroll-btn-left:hover {} .simply-scroll .simply-scroll-btn-right {} .simply-scroll .simply-scroll-btn-right.disabled {} .simply-scroll .simply-scroll-btn-right:hover {} .simply-scroll .simply-scroll-btn-up {} .simply-scroll .simply-scroll-btn-up.disabled {} .simply-scroll .simply-scroll-btn-up:hover {} .simply-scroll .simply-scroll-btn-down {} .simply-scroll .simply-scroll-btn-down.disabled {} .simply-scroll .simply-scroll-btn-down:hover {}
/* Vertical scroller example */
.vert {
/* wider than clip to position buttons to side */
width: 340px;
height: 400px;
margin-bottom: 1.5em;
}
.vert .simply-scroll-clip {
width: 290px;
height: 400px;
}
.vert .simply-scroll-list {} .vert .simply-scroll-list li {
width: 290px;
height: 200px;
}
.vert .simply-scroll-list li img {} .vert .simply-scroll-btn {} .vert .simply-scroll-btn-up {
/* modified btn pos */
right: 0;
top: 0;
}
.vert .simply-scroll-btn-up.disabled {} .vert .simply-scroll-btn-up:hover {} .vert .simply-scroll-btn-down {
/* modified btn pos */
right: 0;
top: 52px;
}
.vert .simply-scroll-btn-down.disabled {} .vert .simply-scroll-btn-down:hover {}
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://budowastrony.pl/images/jquery.simplyscroll.js"></script>
<table>
<tr>
<td>
<ul class="scroller">
<li>
<img src="http://budowastrony.pl/images/img1.jpg" width="290" height="200">
</li>
<li>
<img src="http://budowastrony.pl/images/img2.jpg" width="290" height="200">
</li>
<li>
<img src="http://budowastrony.pl/images/img3.jpg" width="290" height="200">
</li>
<li>
<img src="http://budowastrony.pl/images/img4.jpg" width="290" height="200">
</li>
<li>
<img src="http://www.budowastrony.pl/images/img5.jpg" width="290" height="200">
</li>
</ul>
</td>
</tr>
<tr>
<td>
<ul class="scroller">
<li>
<img src="http://budowastrony.pl/images/img1.jpg" width="290" height="200">
</li>
<li>
<img src="http://budowastrony.pl/images/img2.jpg" width="290" height="200">
</li>
<li>
<img src="http://budowastrony.pl/images/img3.jpg" width="290" height="200">
</li>
<li>
<img src="http://budowastrony.pl/images/img4.jpg" width="290" height="200">
</li>
<li>
<img src="http://www.budowastrony.pl/images/img5.jpg" width="290" height="200">
</li>
</ul>
</td>
</tr>
</table>
<br />
<br />
<br />
<input type="text" value="" />
&#13;
当您想要影响多行时,您可能希望从ID更改为类,就像我在上面的示例中所做的那样。但其他事情都没有改变。
我希望我的例子清楚说明如何使用它。如果你真的有多个幻灯片,重要的是从id更改为类并在js代码中执行相同的操作(id =&#34; scroller&#34; to class =&#34; scroller&#34;,$(& #34;#scroller&#34;)到$(&#34; .scroller&#34;))