2012-11-08 39 views
0

我在這裏有一點麻煩,我有一些腳本,我從這個鏈接jQuery, random div order,這個腳本我用於調用我的查詢與MySQL。限制jQuery與MVC隨機圖像

我的問題是,例如我有8條記錄,但我已經限制只有4條記錄顯示,我希望所有記錄都可以顯示,甚至我已經限制顯示它。怎麼樣?

這裏我的模型

public function get_ads_query(){ 
    $row = $this->db->get('advertise'); 

    return $row; 

} 

這裏是我的觀點

<div id="advertentie" class="advcontainer"> 
    <?php 
     $row = $this->M_front->get_ads_query(); 
     $row = $row->result(); 
     foreach($row as $ads): 
    ?> 
    <div class="adblock"><img src="<?php echo base_url(); ?>images/advertise/<?php echo $ads->Picture; ?>" /></div> 
    <?php endforeach;?> 
</div> 

這裏的jQuery代碼

var $container = $(".advcontainer"); 

setInterval(function(){ 
    $container.html(shuffle($container.children().get())); 
}, 1500); 
$(".advcontainer div").each(function(){ 
    var color = $(this).attr("class"); 
    $(this).css({backgroundColor: color}); 
}); 
function shuffle(o){ 
    for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x); 
    return o; 
}; 

謝謝

回答