Post by labeshops » Tue Jun 19, 2012 9:43 pm

Okay, this is driving me nuts.

www.labeshops.com shop by category banners. I got everything the way I want with an autoscroll but I want to pause the scroll on mouse hover and nothing seems to work :P Found coding examples, but think I am missing something.

In my carousel template, I modified the bottom script to:

Code: Select all

<script type="text/javascript"><!--
$('#carousel<?php echo $module; ?> ul').jcarousel({
	vertical: false,
	visible: <?php echo $limit; ?>,
	scroll: <?php echo $scroll; ?>,
    create: $('.jcarousel').hover(function() {
                $(this).jcarousel('stop');
            },
            function() {
                $(this).jcarousel('start');
            })	
});
//--></script>
adding the create section. What the heck am I missing?

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by florinsith » Tue Jun 19, 2012 11:34 pm

try this one;

Code: Select all

create: $('jcarousel').bind('mouseenter', function () {
                $(this).jcarousel('option', 'scroll', '+=0' );
            }).bind('mouseleave', function () {
                $(this).jcarousel('option', 'scroll', '+=<?php echo $scroll; ?>' );
            })
I found it on stackoverflow.

Image
My Extensions - SuperTheme - Opencart templates - Opencart modules


User avatar
Expert Member

Posts

Joined
Fri May 14, 2010 2:36 am


Post by labeshops » Wed Jun 20, 2012 2:57 am

Yup, tried that one to and no pause :P

I think I'm missing something...just not sure what :(

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by Datura » Wed Jul 11, 2012 3:51 pm

Try this:

Code: Select all

<script type="text/javascript"><!--
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {
  $('#carousel<?php echo $module; ?> ul').jcarousel({
	  vertical: false,
	  initCallback: mycarousel_initCallback,
	  visible: <?php echo $limit; ?>,
	  scroll: <?php echo $scroll; ?>
  });
});
//--></script>

My very own OpenCart Shop


User avatar
Newbie

Posts

Joined
Sat Apr 21, 2012 6:05 pm
Location - Netherlands

Post by f1br3opt1c » Fri May 24, 2013 5:38 pm

I've tried all the codes posted on this thread but none seem to work. Does anyone have a working code for pause on hover please?

New member

Posts

Joined
Fri May 24, 2013 5:36 pm

Post by NoJoke » Sat Feb 22, 2014 5:25 am

In the bottom of the carousel.tpl file change

Code: Select all

<script type="text/javascript"><!--
$('#carousel<?php echo $module; ?> ul').jcarousel({
	vertical: false,
	visible: <?php echo $limit; ?>,
	scroll: <?php echo $scroll; ?>
});
//--></script>
to :

Code: Select all

<script type="text/javascript"><!--

//Init callback
function initCallbackFx(carousel, obejctli,liindex,listate){
    $("#carousel<?php echo $module; ?> ul").mouseenter(function(){
        carousel.stopAuto();
    }).mouseleave(function(){
        carousel.startAuto();
    });
}

$(function(){
  $("#carousel<?php echo $module; ?> ul").jcarousel({
            wrap : 'circular',
            auto : 4,
            visible: <?php echo $limit; ?>,
	      scroll: <?php echo $scroll; ?>,
            animation: 'slow',
            initCallback : initCallbackFx
  });
});


//--></script>
That should change it to auto scroll and then pause on hover

Active Member

Posts

Joined
Fri Oct 14, 2011 5:37 am
Who is online

Users browsing this forum: No registered users and 9 guests