How to change background images whenever click on the next or previous button?

Hello,
How to change background images whenever click on the next or previous button?

Have a list of images, and a custom state number.

Display the image from the list corresponding to the custom state number.

When the next or previous button is clicked, add or subtract 1 from that number (keeping it between 1 and the number of images in the list).

where should be the list of images in option set or somewhere else.

Anywhere you like

(depending of course on the specifics of your app, how it’s structured, and what you’re trying to do).

i am just practicing that if any group has a background image and when we press next or previous how does its images change.
i set a option set with images attribute and number attribute with it, then create a state in group with number list. but confuse that when click on next then how to set states

You don’t need to set a number attribute on the Option Set (although you can do that) - items in a list always have an item number anyway, so you can just use that.

To set the state values just run a workflow with an action to set the state.

in workflow how to set state, like i used condition that group_custom _state not empty for first one, then how to do for further images

I’m not sure I understand what you’re asking…

Just run a workflow when the next button is clicked to add one to the current value, and another workflow when the previous button is clicked to subtract one from the current value.

I’d use a condition on the buttons themselves to make the unclickable or not visible when each end of the list is reached (i.e. 1 and the number of images)

okay thanks @adamhholmes , you helped me every time. i will leave a message if i would solved this

Here’s a simple example:

Image List (bubbleapps.io)

Great solved. Two more question
If i want to make it like that when i click next it gets back to first image when all image is finish. like its rotating image and never end to display.
and in dynamic image value what is the role of bracket and how to get it.

In that case just set the number back to 1 when the current number = the image list count

And set it to the image lit count when it is 1

to enable parenthesis in your app go to your app settings, version, and enable the option (although it’s not needed for this)

ok Thank you

This topic was automatically closed after 70 days. New replies are no longer allowed.