3

So the images show when the site loads, but when i navigate to another tab and then come back to the first tab, the images are not showing. Then i have to refresh the site for the image to show. I have tried to find the answer, but seems it is a very simple thing that i have overlooked.

Note: I am using a JavaScript background slider to show the images. index.html.erb:

<%= stylesheet_link_tag "home" %>
<%= javascript_include_tag "index" %>
<div id="background_cycler" >
<script type="text/javascript">
$('#background_cycler').hide();
</script>

<img class="active" src="/assets/back/back2.jpg" alt=""/>
<img src="/assets/back/back2.jpg" alt="" />
<img src="/assets/back/back4.jpg" alt="" />
<img src="/assets/back/back5.jpg" alt="" />
</div>

Grateful for any kind of help.

adnan.mujkic
  • 83
  • 1
  • 1
  • 6
  • 1
    I found the answer thank's to this post: [link]http://stackoverflow.com/questions/18770517/rails-4-how-to-use-document-ready-with-turbo-links I had to load the JavaScript file first: $(window).on('page:load', function(){ ...code }) – adnan.mujkic Apr 18 '16 at 00:40

0 Answers0