Donvini
Donvini

Reputation: 15

Rails loads Picture only on reload, not if link clicked

Since 2 days I'm trying to solve a really strange issue. On first Visit of my rails web app loads a picture, but if you click on Home in the navbar to get to the same page, the picture doesn't load. If you reload the page after this, it appears again. For you to see yourself I am totally clueless on how to solve this and whats the cause..

Upvotes: 0

Views: 50

Answers (2)

Rebel Rider
Rebel Rider

Reputation: 167

try to add below code for home link like:

<%= link_to('home', home_path, data: { no_turbolink: false}) %>

Upvotes: 0

Dima I. Belinski
Dima I. Belinski

Reputation: 381

You use turbolinks.

try to put your js-slider code like this

$(document).on('turbolinks:load', function() {
  $( document ).ready(function() {
    // your js-slider code here
  })
});

or just put this in application.js and require owl-carousel from aplication.js

Upvotes: 1

Related Questions