Banner image change after refresh the page | Community
Skip to main content
varuns46785756
New Participant
February 22, 2017
Solved

Banner image change after refresh the page

  • February 22, 2017
  • 11 replies
  • 9230 views

Hi,

I need to create a banner component, I need to display one image at a time on banner , when user refresh the page then next image will display, if we have five images for this banner then all the five images will be display one by one on page refresh.All the images coming from dam.Please suggest

 

 

Regards,

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by edubey

Hi Varun,

I see two scenarios :- 

1. Load a image: If you want to load a image when user refresh browser, you can simply call random() method and load the respective image which I believe @kautuksahni has explained very well.

2. Load different image everytime: If you want to load a image and also make sure its different from the previous one then you have to keep track of current image name/id in browser session so that when next time page loads you can verify.

Thanks

11 replies

kautuk_sahni
Employee
February 23, 2017

Hi Varun

Yes, this can be done. But i am not able to understand the use-case here. What is the ask that for every refresh we need new image?

Carousel component could be used with increased time to switch image.

Otherwise you can write a custom component where in you can put a logic in the JS that will create a random number every time the page loads and then use this random number to access the arrey's index having paths for images.

Refer to this post :- http://stackoverflow.com/questions/29933027/refreshing-page-with-a-new-image

Also See this example :- https://gist.github.com/stephenscaff/8266351

~kautuk

Kautuk Sahni