Permalink
Browse files

Merge pull request #16 from Erftralle/fix-motiongallery

Use new motion gallery and motion gallery limits
  • Loading branch information...
2 parents 2dc0cad + 358b4e3 commit b46548beb63212330ff4c6ca0d2d8521b8848be5 @Chraneco Chraneco committed on GitHub Jun 19, 2016
Showing with 46 additions and 12 deletions.
  1. +46 −12 components/com_joomgallery/views/detail/tmpl/bootone.php
@@ -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>

0 comments on commit b46548b

Please sign in to comment.