Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 responsive carousels on one page - settings #846

Open
hejke opened this issue Aug 2, 2019 · 0 comments
Open

2 responsive carousels on one page - settings #846

hejke opened this issue Aug 2, 2019 · 0 comments

Comments

@hejke
Copy link

hejke commented Aug 2, 2019

Hi,

I am trying to have two independent, responsive carousels on the same page. In HTML structure they are the same. The first carousel has CSS-class "jcarousel", the second "jcarousel_tipps"

The first carousel (jcarousel) works fine.

I use the settings:

	var jcarousel = $('.jcarousel');

    jcarousel
        .on('jcarousel:reload jcarousel:create', function () {
            var width = jcarousel.innerWidth();
            
            if(width >= 1000){
            	width = width / 5;
            } else if (width >= 900) {
                width = width / 4;
            } else if (width >= 650) {
                width = width / 3;
            } else if (width >= 300) {
                width = width / 2;
			}

            jcarousel.jcarousel('items').css('width', Math.ceil(width) + 'px');
        })
        .jcarousel({
            wrap: 'circular'
        });

    $('.jcarousel-control-prev')
        .jcarouselControl({
            target: '-=1'
        });

    $('.jcarousel-control-next')
        .jcarouselControl({
            target: '+=1'
    	});
    
	$('.jcarousel').jcarouselAutoscroll({
   	interval: 6500
	});

The second carousel does not look nice. It is not responsive, the single items are far too wide.

I use the settings:

    var jcarousel_tipps = $('.jcarousel_tipps');

    jcarousel_tipps
        .on('jcarousel_tipps:reload jcarousel_tipps:create', function () {
            var width = jcarousel.innerWidth();
            if(width >= 1000){
            	width = width / 5;
            } else if (width >= 900) {
                width = width / 4;
            } else if (width >= 650) {
                width = width / 3;
            } else if (width >= 300) {
                width = width / 2;
			}
            jcarousel.jcarousel('items').css('width', Math.ceil(width) + 'px');
        })
        .jcarousel({
            wrap: 'circular'
        });
    
        
       $('.jcarousel_tipps-control-prev')
        .jcarouselControl({
            target: '-=1'
        });

    	$('.jcarousel_tipps-control-next')
        .jcarouselControl({
            target: '+=1'
    	});
		
	$('.jcarousel_tipps').jcarouselAutoscroll({
	interval: 7500
	});

Do you have any clue whats wrong?

Here you can see the page, but it's still very much under development...https://new.polarlichtexpress.de/

Thank you so much for your time in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant