I have this code is working fine just I want to add autoplay between pagination after 10 seconds passes to the other page (interval carousel) Code :
<?php
$gethads = $DB_con->prepare("SELECT id,img FROM `homeads` ORDER BY id ASC");
$gethads->execute();
if($gethads->rowCount() > 0){
foreach ($gethads->fetchAll() as $rowH){
echo'
<div class=" line-content">
<img src="'.DIR.'uploads/'.$rowH['img'].'">
</div>
';
}
}
?>
<ul id="pagin">
<?php if($gethads->rowCount() > 8){ ?><a class="current" href="#">1</a> <?php } ?>
<?php if($gethads->rowCount() > 8){ ?><a href="#">2</a> <?php } ?>
<?php if($gethads->rowCount() > 16){ ?><a href="#">3</a> <?php } ?>
<?php if($gethads->rowCount() > 24){ ?><a href="#">4</a> <?php } ?>
</ul>
<script type="text/javascript">
pageSize = 8;
showPage = function(page) {
$(".line-content").hide();
$(".line-content").each(function(n) {
if (n >= pageSize * (page - 1) && n < pageSize * page)
$(this).show();
});
}
showPage(1);
$("#pagin a").click(function() {
$("#pagin a").removeClass("current");
$(this).addClass("current");
showPage(parseInt($(this).text()))
});
</script>
Comments
Post a Comment