0

I have the following php,

<?php
  $items_position = $helper->get('position');
  $mods = JModuleHelper::getModules($items_position);
  $count = count($mods); 

  $doc = JFactory::getDocument();
  $doc->addScript (T3_TEMPLATE_URL . '/acm/container-slideshow/js/landing/jquery.easing.js');
  $doc->addScript (T3_TEMPLATE_URL.'/acm/container-slideshow/js/landing/jquery.mousewheel.min.js');
  $doc->addScript (T3_TEMPLATE_URL.'/acm/container-slideshow/js/landing/jquery.singular.js');
?>

<div class="style-1 block-landing">
  <?php $i = 1; foreach ($mods as $mod) : ?>
  <div class="block-landing-item <?php if (isset($animation)) echo $animation; ?>" id="block-landing-item-<?php echo $mod->id; ?>">
    <?php
      echo JModuleHelper::renderModule($mod);
  ?>

  <?php if (($i==$count-1) && $helper->get('enable-leave-slide')): ?>
    <a class="arrow-bottom block-landing-next" href="#"><i class="fa fa-long-arrow-down"></i></a>
  <?php endif; ?>
  </div>
  <?php $i++; endforeach; ?>



  <div class="mod-nav">
      <ul class="block-landing-nav">
          <?php $i = 0; foreach ($mods as $mod) : ?>
          <li class="mod-nav-item"><a href="#block-landing-item-<?php echo $mod->id; ?>"><?php echo $mod->id; ?></a></li>
          <?php $i++; endforeach; ?>
          <?php if($helper->get('enable-leave-slide')): ?>

          <?php endif; ?>
      </ul>
      <!-- /mod-nav -->
  </div>
</div>

<script>
    (function($){
        var iOS = parseFloat(('' + (/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0,''])[1]).replace('undefined', '3_2').replace('_', '.').replace('_', '')) || false;
        if(!(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || iOS)) {
            var slide = $('.block-landing');
              var parent = slide.parents('#t3-section');
              slide.singular({
                  section: '.block-landing-item',
                  nav: '.block-landing-nav',
                  prev: '.block-landing-prev',
                  next: '.block-landing-next',
                  navActiveClass: 'block-landing-active',
                  scrollSpeed: 600,
                  mousewheel: true,
                  easing: 'easeInOutQuart',
                  scrollEnd: function(elem) {
                      if ($('.block-landing-nav .block-landing-active').hasClass('sec-last')) {
                          $('#sec-last').animate({
                              height: 0,
                              opacity: 0
                          }, 400, function() {
                              parent.addClass('slide-hide');
                              $('html, body').css('overflow', 'unset');
                          });
                      }
                  }
              });

              $(window).on('mousewheel', function(e, delta) {
                  if(delta < -0.8) {

                  }
                  if(delta > 0.8) {
                      if ($(this).scrollTop() == 0) {
                          parent.removeClass('slide-hide');
                          $('.block-landing-prev', '#sec-last').click();
                          $('html, body').css('overflow', 'hidden');
                      }
                  }
              });
        } else {
            $('.home-landing').css('overflow','unset');
            $('.block-landing').css('position','static');
            $('.block-landing > div').css('height','auto!important');
            $('.block-landing-nav').css('display','none');
        }
    })(jQuery);
</script>

This code is used to generate a little arrow that points down to let you know that you need to scroll in my container slideshow.

The problem is that the little arrow only shows on the last slide item. It should show on all of the slides except from the last slide.

Don't suppose anyone could help me to display this on all but last?

Thanks, Richard

1

I think that in that part of the code:

 <?php if (($i==$count-1) && $helper->get('enable-leave-slide')): ?>

$i == $count-1 will be true only in the last slide and that is way it shows only in that case. you may change the line for this one:

 <?php if ($helper->get('enable-leave-slide')): ?>

Hope this will help ypu

2
  • Hi there, thanks for your help much appreciated. It was my fault as I hadn't set the module ordering correctly. All of my items were set to 1. so after changing this so the modules are in order 1,2,3 it works. – gringo211985 Oct 26 '15 at 15:30
  • glad you fix it – Piero Marsilio Oct 26 '15 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.