Skip Navigation

[Resolved] How can I make the Views Slider "touch responsive"

This support ticket is created 5 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by PaulS4783 5 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#1216915

I have a slider that works fine:
hidden link

One BIG problem though, it isn't touch screen responsive.
This is going to be a deal breaker with some clients who expect touch screen sliders given that its a common place feature of the web nowdays.

I've looked at some different solutions here:
https://stackoverflow.com/questions/21349984/how-to-make-bootstrap-carousel-slider-use-mobile-left-right-swipe

And this seems promising since it doesnt require any additional libraries (if I am reading correctly)

$(".carousel").on("touchstart", function(event){
        var xClick = event.originalEvent.touches[0].pageX;
    $(this).one("touchmove", function(event){
        var xMove = event.originalEvent.touches[0].pageX;
        if( Math.floor(xClick - xMove) > 5 ){
            $(this).carousel('next');
        }
        else if( Math.floor(xClick - xMove) < -5 ){
            $(this).carousel('prev');
        }
    });
    $(".carousel").on("touchend", function(){
            $(this).off("touchmove");
    });
});

But I dont understand how to implement it with my View.

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	<table width="100%" class="wpv-loop js-wpv-loop">
	<wpv-loop wrap="2" pad="true">
		[wpv-item index=1]
		<tr>
			<td id="one" width="49.99%">
				[wpv-post-body view_template="loop-item-in-featured-vehicles"]
			</td>
		[wpv-item index=other]
			<td id="two">
				[wpv-post-body view_template="loop-item-in-featured-vehicles"]
			</td>
		[wpv-item index=2]
			<td id="three" width="49.99%">
				[wpv-post-body view_template="loop-item-in-featured-vehicles"]
			</td>
		</tr>
		[wpv-item index=pad]
			<td id="four"></td>
		[wpv-item index=pad-last]
			<td id="five"></td>
		</tr>
	</wpv-loop>
	</table>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]
#1217307

Hi, the short answer is this code won't work with Views Sliders because it's designed to be used with a Bootstrap Carousel. The infrastructure for a Views Slider and a Bootstrap Carousel are quite different, and this code is written specifically for Bootstrap Carousel. So if you wanted to use this JavaScript code you would have to remove all the special slider elements from your View like pagination, navigation, and effects. Then you would have to modify the loop code to generate the structure of a Bootstrap Carousel. There's documentation available here: https://getbootstrap.com/docs/3.3/javascript/#carousel

It's a rather custom implementation, so it's not something I can whip up for you here in the support forums.

#1217344

OK. You can close the ticket.
I'll have to look at other ways to achieve this, I guess.

fyi I think a "touch screen responsive" Views Slider should be HIGH on the ToolSet feature request list.
As I mentioned, it could be a deal breaker for some clients.
It's border-line unprofessional in a mobile web era to NOT have touch screen enabled functionality.

cheers.