What's the usage of longSwipes and shortSwipes config in swiper? - javascript

When I read the swiper's docs, I can not get what's the usage of longSwipes. Can anyone tell me ? It's best to give an example. Thanks.
https://swiperjs.com/swiper-api#swiper-full-html-layout

Old post but here are my findings...
By default shortSwipes moves to the next slide with a very short swipe distance. Long swipe moves to the next slide when the current slide is dragged > 50% of the view.
When setting shortSwipes to false, you now have to drag the slide more than 50% of the view to advance to the next/prev slide.
When setting longSwipes to false, you now can only advance to the next/prev slide with a very short drag.
When setting both shortSwipes and longSwipes to false, swiping becomes disabled.

Related

How to make slick slider with cropped slides

I need to make slick slider where next slider from right is cropped by half, but not from the left side. I did it with set up slidesToShow: 1.5, like in the screen below.
But also I need to make that if it's the last slide, then the previous slide should cropped by half and after the last slide there is not empty space, like in the screen below.
And if I swipe back it should be like in the first screen, cropped by the right side only.
How can I achieve this? I was looking for examples but didn't find much.
Just add folowing css
div.slick-list{
padding:0 50px 0 0;
}

swiper api - how to stop a slide from overscrolling

I am using the iDangerous Swiper. By default if you touch and drag the first slide to the right, it allows you to kind of force it to the right, similar to how an iphone browser works, where it is kind of elastic and it only lets you drag a little.
Is there a a paremeter to prevent this? I would also want the last slide to not be able to slide more to the left, since it will reveal what is underneath.
found it... need to initialize with resistanceRatio: 0
var swiper = new Swiper(this.swiperContainer, {
resistanceRatio: 0
});

jQuery carousel slider with auto widths and direction based dynamic alignment

I'm looking for a responsive jQuery carousel content slider with custom/different/auto widths that scrolls by one item and aligns based on the direction.
For example if the user clicks on the right navigation arrow it should slide slide by one item to the first not fully visible item and it should be aligned to the right end of the viewport and if the user clicks on the left navigation arrow the slider should slide by one item to the first not fully visible item on the left end of the viewport and align it to the same end.
I've spent a couple of days searching for such carousel but so far with no luck. Some of the sliders/carousels I've looked into are: LightSlider, slick, Flickity, Glide, UIkit (getuikit) and more. I've even written a new navigation logic for Flickity using its API which almost does it but it's buggy and with a lot of animation problems.
$(document).ready(function() {
$('#autoWidth').lightSlider({
autoWidth:true,
loop:false,
pager:false,
prevHtml:'<',
nextHtml:'>',
onSliderLoad: function() {
$('#autoWidth').removeClass('cS-hidden');
}
}).goToSlide(6);
});
As a behavioural example open this link http://codepen.io/matthewd/pen/BKvjWM, click the left and then the right arrow.
Any suggestions would be highly appreciated.
Thank you!

How to stop slider to be cycled again in glide.js?

Once a slider has finished all slides how to stop the slider after the last slide. Disabling moving forward but enabling moving backward.
http://glide.jedrzejchalubek.com/docs.html
It's really simple, because it is buildin into plugin. You just need to set glide type to slider.
$('#Slider').glide({
type: 'slider'
});

Help needed centering thumbnail based on class name - Jquery

I have a slide show component I've been working on that is a mash up of jcycle and jcarousel. It works rather well, yet there is one last feature I'd to add that I cannot figure out. Right now if you click on a thumbnail it will center it in the carousel as long as it's not the first 2 or last 2 thumbs. This works great and I like centering the active thumbnail of the slide show.
The problem I'm running into is if the user hits the play button on the slide show or the next and previous slide buttons, the slide show cycles, yet the active slide thumbnail does not center in the carousel. I've tried unsuccessfully to check if the thumbnail anchor has class, activeSlide, and if so to center it, yet cant seem to get it to work.
Here is a link to the demo page I've been working on.
http://brettjankord.com/standards/slideshows/jslideshow-test2.php
Any help is greatly appreciated!
Put the following at the end of your onBefore method
var carousel = $('#mycarousel').data('jcarousel');
var activeIdx = $('#mycarousel img[src="'+next.src+'"]').closest('a').data('index') -2;
if (carousel)
{
carousel.scroll(activeIdx);
}
Demo at http://jsfiddle.net/JupPn/1/

Categories