Subroutine for content slider - Forum

Forum Navigation
You need to log in to create posts and topics.

Subroutine for content slider

I have a content slider with some slide...

I want when I  change the slide on touch screen, a subroutine should be done.

How can I do this??

Sorry @asmat, it's a very simple plugin and doesn't have that functionality.
Regards.

@asmat

I want when I change the slide on touch screen, a subroutine should be done.

Can you explain in detail what you mean by "change the slide on touch screen"

On my Windows 10 (non-touch screen) laptop, I can specify code for the click event of the host Container.

Are you talking about the slide-change-event during the AutoSlide process ? ... or something else ?

I have a sample slider for a timetable .

Each slide is allocated for a day.

You can understand me better in this picture;

https://drive.google.com/file/d/1TUmAyG0FIBnUWP3sg6i0yxNZ8bAMmjUr/view?usp=sharing

@asmat

Thank you for the pictorial explanation.

You wrote ... "when the slide has changed, the day should change also"

One more question ... what makes/causes the slide to change ? ...

1) as indicated by the image of the hand ...

a) do you tap on the Host Container ? ... as stated before, I can click on it and trigger the click-event of the Host Container.

or

b) do you swipe on the Host Container ? ... I can't test that on my on my non-touch-screen laptop.

or

2) is it in AutoSlide mode ? ... in which case, the only work around would be to ...

- keep it in non-AutoSlide mode
- use your own Timer to update both objects at every timer interval

The slides change by finger....

I meant, when the slide  change completely according that the day also should change....

You can see the below video, In this video the slides have changed by moving finger.

https://drive.google.com/file/d/1-TKXwgIMwrgk2xfH-NHvuaLfGur68zKe/view?usp=sharing

here, we need an action code.

slGetCurrentSlide "mysliderContainer" [x]

If [x] == 0
SetVar [day] "Monday"
EndIf

If [x] == 1
SetVar [day] "Tuesday"
EndIf

and so on ....

My question is this, where should I put this code??

@asmat

Ideally, there should be a subroutine that is called every time a new slide element is shown ... there is one available in the Bootstrap/jQuery plugin called bxSlider , which is wrapped inside slSlider ... but I don't see this particular feature implemented in slSlider.

So, the alternative is to make the best of what is available i.e. slGetCurrentSlide

My question is this, where should I put this code??

You can start a Timer in your PageEnter section ...

SetVar [howOften] 500 ... number in milliseconds
SetInterval [howOften] "sliderCheckSubroutine" [mySliderCheckId]

In your subroutine named sliderCheckSubroutine ...

slGetCurrentSlide "yourSliderHostContainer" "[currentSlideNumber]"
... rest of your code to sync the number with the 'day of week' goes here

Don't forget to ...

ClearInterval [mySliderCheckId]

... when leaving the page.