0
Good evening, everyone. I have a question. I am doing an image gallery and would like to know how I know what is the first and last element. Like I have the right and left arrows for previous image or next image. Dai type when arriving at the last image I want to hide the arrow to the next image and when I have in the first image I would like to hide the arrow to the previous image. You can help me?
You can include the relevant code of your gallery? Usually to do this you store the number of the current item in a variable that is incremented when you advance, and decremented when backwards. Knowing how many items you have in the gallery makes it easy to know if you are on the first or last.
– bfavaretto
@bfavaretto actually I already do that you talked about. I actually just wanted to know what is the first and last element
– Gabriel Schmidt Cordeiro
Well, if you already have this variable, just check if its value is zero (or 1, depending on how you implemented it) to hide the left arrow, and compare it to the collection size to hide the right arrow.
– bfavaretto