Skip to content

Commit

Permalink
Merge pull request #16 from Erftralle/fix-motiongallery
Browse files Browse the repository at this point in the history
Use new motion gallery and motion gallery limits
  • Loading branch information
Chraneco committed Jun 19, 2016
2 parents 2dc0cad + 358b4e3 commit b46548b
Showing 1 changed file with 46 additions and 12 deletions.
58 changes: 46 additions & 12 deletions components/com_joomgallery/views/detail/tmpl/bootone.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,56 @@
<div class="jg-minis">
<?php if($this->_config->get('jg_motionminis') == 2): ?>
<div id="motioncontainer">
<div id="motiongallery">
<div style="white-space:nowrap;" id="trueContainer">
<ul>
<?php endif;
if(count($this->images)):
foreach($this->images as $row): ?>
$rows = array();
$limit = $this->_config->get('jg_motionminiLimit');

if ($limit > 0)
{
$imageposition = ($this->image->position + 1) - $limit/2;
$imageposition = min($imageposition, count($this->images) - $limit);
$rows = array_splice($this->images, max(0, $imageposition), $limit);
}
else
{
$rows = $this->images;
}

foreach($rows as $row):
if($this->_config->get('jg_motionminis') == 2): ?>
<li>
<?php endif; ?>
<a title="<?php echo $row->imgtitle; ?>" href="<?php echo JRoute::_('index.php?view=detail&id='.$row->id).JHTML::_('joomgallery.anchor'); ?>">
<?php $cssid = '';
if($row->id == $this->image->id):
$cssid = ' id="jg_mini_akt"';
endif; ?>
<?php $cssid = '';
if($row->id == $this->image->id):
$cssid = ' id="jg_mini_akt"';
endif; ?>
<img src="<?php echo $this->_ambit->getImg('thumb_url', $row); ?>"<?php echo $cssid; ?> class="jg_minipic" alt="<?php echo $row->imgtitle; ?>" /></a>
<?php endforeach;
endif;
<?php if($this->_config->get('jg_motionminis') == 2): ?>
</li>
<?php endif; ?>
<?php endforeach;
if($this->_config->get('jg_motionminis') == 2): ?>
</div>
</div>
</ul>
<script>
(function($){
$(window).load(function(){
$("#motioncontainer").mThumbnailScroller({
axis:"x",
type:"hover-20",
callbacks:{
onInit:function(){
var $this = $(this);
var moveTo = $("#jg_mini_akt").position().left + ($("#jg_mini_akt").width() / 2) - ($("#motioncontainer").find(".mTSWrapper").width() / 2);
$this.mThumbnailScroller("scrollTo", (moveTo > 0 ? moveTo : "left"));
setTimeout(function() { $this.addClass("jg_scroller-ready"); }, 300);
}
},
});
});
})(jQuery);
</script>
</div>
<?php endif; ?>
</div>
Expand Down

0 comments on commit b46548b

Please sign in to comment.