- Posts: 2
- Thank you received: 0
<script type="text/javascript">
jQuery(document).ready(function($){
// -------------------Load more-------------------------------------
var $showMore = $('#ShowMore'), // or whatever your show more button is called
$container = $("#juxContainer<?php echo $module->id;?>");
// New ways
var $currentURL = '<?php echo JURI::getInstance()->toString(); ?>';
var $start = <?php echo $limit ?>; // ajax start from last limit
var $limit = <?php echo $ajaxlimit ?>;
var $totalitem = <?php echo $total?>;
var $waitForLoad = false;
// Instantiate MixItup with a limit of 12 items
$container.mixItUp({
animation: {
enable: <?php echo ($params->get('animation') == 1)?"true":"false";?>,
duration: <?php echo $params->get('animation_duration')?>,
effects: "<?php echo $params->get('animation_effect')?>"
},
load: {
filter: "all",
sort: "default"
},
layout: {
display: "inline-block",
containerClass: '<?php echo $load_layout;?>' // Add the class 'list' to the container on load
}
});
// Bind a click handler to the show more button
$("#jux_mashup<?php echo $module->id;?>").on("click","#ShowMore",function() {
if ($waitForLoad == false){
$('#loadmore-text').text('loading...');
$waitForLoad = true;
$.get($currentURL, {
moduleID: <?php echo $module->id; ?>,
start:$start,
limit: $limit
}, function(data){
$start += $limit;
var $newItems = $(data);
var $target = $newItems.find('#juxContainer<?php echo $module->id; ?>').html();
var $newContents = $($target);
$container.mixItUp('append', $newContents, {});
//if articles are loaded then enable the "load more" button again. If not.. ignore
if ($container.mixItUp("isLoaded"))
{
$waitForLoad = false;
$('#loadmore-text').text('<?php echo JText::_('JUX_VIEW_MORE'); ?>');
}
if($totalitem <= $start){
$('#jux_mashup<?php echo $module->id;?> .jux-loadmore').html('');
}
});
}
});
//--------------------------------End loadmore------------------------------------------
});
</script>
Please Log in or Create an account to join the conversation.