title: Parallax only works on page refresh, not on redirect
body: <p>I am using the Materialize css parallax. It works fine on the first page load up, but when it is redirected to any other page in the site, none of the parallaxes render the pictures. When the page is reloaded however, it once again shows the pictures. </p>
  
  <p>I have tried to preload the pictures with css, and jquery preloader; no effect. I have included the full link like this: <code>&lt;img class="parallax" src="localhost:3000/app/assets/images/brainbanner.gif"&gt;</code> and it has not rendered. </p>
  
  <p>I also tried to dump the image into another page and calling it by its full web address, but nothing. It does not even appear on refresh. I would like a way to make this pictures appear on the first load, or a way to refresh the page after it is redirected, going to the page twice in one redirect.<br>
  This is my application.html.erb file: </p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
      &lt;html&gt;
      &lt;head&gt;
        &lt;title&gt;NicolasDev&lt;/title&gt;
        &lt;%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' =&gt; true %&gt;
        &lt;%= javascript_include_tag 'application', 'data-turbolinks-track' =&gt; true %&gt;
        &lt;%= csrf_meta_tags %&gt;
        &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/&gt;
        &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/&gt;
  
  
        &lt;link href='https://fonts.googleapis.com/css?family=Courgette' rel='stylesheet' type='text/css'&gt;
        &lt;!-- CSS  --&gt;
        &lt;link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"&gt;
        &lt;link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/&gt;
        &lt;link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/&gt;
        &lt;script src="jquery-2.0.2.min.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
  
  
  
  
  
      &lt;%= yield %&gt;
  
  
  
      &lt;footer class="page-footer teal"&gt;
        &lt;div class="container"&gt;
          &lt;div class="row"&gt;
  
            &lt;div style="text-align: center;"&gt;
              &lt;h5 class="white-text"&gt;Going up &lt;span class="pf_cite"&gt;?&lt;/span&gt;&lt;/h5&gt;
              &lt;ul&gt;
                &lt;li&gt;&lt;div class="elevator waves-effect waves-light btn"&gt;Yes!&lt;/div&gt;&lt;/li&gt;
  
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  
  
      &lt;/footer&gt;
  
      &lt;script type="text/javascript"&gt;
        $( document ).ready(function() {
          $('.parallax').parallax();
        });
  
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        $( document ).ready(function() {
          $(function() {
              preloadCssImages();
          });
        };
  
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
  
          // Simple elevator usage.
        var elementButton = document.querySelector('.elevator');
        var elevator = new Elevator({
          element: elementButton,
          mainAudio: './audio/elevator.mp3', // Music from http://www.bensound.com/
          endAudio: './audio/ding.mp3',
          duration: 3000
        });
  
      &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        $( document ).ready(function() {function(event) {
          jQuery.preloadCssImages = function(){
  
            var allImgs = [];//new array for all the image urls  
            var k = 0; //iterator for adding images
            var sheets = document.styleSheets;//array of stylesheets
  
            for(var i = 0; i0 &amp;&amp; imgUrls != ''){//loop array
  
                var arr = jQuery.makeArray(imgUrls);//create array from regex obj        
  
                jQuery(arr).each(function(){
                  allImgs[k] = new Image(); //new img obj
                  allImgs[k].src = (this[0] == '/' || this.match('http://')) ? this : baseURL + this;     //set src either absolute or rel to css dir
                  k++;
                });
              }
            }//loop
            return allImgs;
          }
  
          $.preloadCssImages();
  
  
  
          var preloadedImgs = $.preloadCssImages();
  
  
        });
      &lt;/script&gt;
      &lt;/body&gt;
  
      &lt;/html&gt;
  </code></pre>
  
  <p>This is my home page: </p>
  
  <pre><code>    &lt;div id="index-banner" class="parallax-container"&gt;
        &lt;div class="section no-pad-bot"&gt;
          &lt;div class="container"&gt;
  
            &lt;h1 class="header center teal-text text-lighten-2"&gt;Nicolas Dev&lt;/h1&gt;
            &lt;div class="row center"&gt;
              &lt;h5 class="header col s12 light"&gt;Development meets imagination.&lt;/h5&gt;
            &lt;/div&gt;
            &lt;div class="row center"&gt;
  
            &lt;/div&gt;
  
  
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="parallax" id="one" alt="Unsplashed background img 1")%&gt;&lt;/div&gt;
      &lt;/div&gt;
  
  
      &lt;div class="container" style="margin-top: 0px;"&gt;
        &lt;div class="section"&gt;
          &lt;!--   Icon Section   --&gt;
          &lt;div class="row"&gt;
            &lt;div class="col s12 m4"&gt;
              &lt;div class="icon-block"&gt;
                &lt;h2 class="center brown-text"&gt;&lt;%= link_to  image_tag('portfolio.png', height: '82', width: '82'), "http://localhost:3000/pages/porfolio" %&gt;&lt;/h2&gt;
                &lt;h5 class="center"&gt;Porfolio&lt;/h5&gt;
                &lt;p class="light"&gt;&lt;/p&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="col s12 m4"&gt;
              &lt;div class="icon-block"&gt;
                &lt;h2 class="center brown-text"&gt;&lt;%= link_to image_tag('github.png', height: '82', width: '82'), "https://github.com/nbr625", :target =&gt; "_blank"%&gt;&lt;/h2&gt;
                &lt;h5 class="center"&gt;Github&lt;/h5&gt;
              &lt;/div&gt;
            &lt;/div&gt;
            &lt;div class="col s12 m4"&gt;
              &lt;div class="icon-block"&gt;
                &lt;h2 class="center brown-text"&gt;&lt;%= image_tag('contact.png', height: '82', width: '82')%&gt;&lt;/h2&gt;
                &lt;h5 class="center"&gt;Message Me&lt;/h5&gt;
                &lt;p class="light"&gt;&lt;/p&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
  
  
      &lt;div class="container"&gt;
        &lt;div class="section"&gt;
          &lt;div class="row"&gt;
            &lt;div class="col s12 center"&gt;
              &lt;h3&gt;&lt;i class="mdi-content-send brown-text"&gt;&lt;/i&gt;&lt;/h3&gt;
              &lt;h4&gt;Nicolas&lt;/h4&gt;
              &lt;p class="left-align light"&gt;As you might have guessed, my name is Nicolas. Nicolas Berrizbeitia. My job is to build responsive, proffessional platforms that suit the needs of my clients.  My passion...&lt;/p&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
  
  
  
  
      &lt;div class="parallax-container valign-wrapper"&gt;
        &lt;div class="section no-pad-bot"&gt;
          &lt;div class="container"&gt;
            &lt;div class="row center"&gt;
              &lt;h5 class="header col s12 light"&gt;... Is crafting immersive web experiences.&lt;/h5&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  
  
        &lt;div class="parallax" id="two" alt="Unsplashed background img 2"&gt;&lt;/div&gt;
      &lt;/div&gt;
  
  
  
  
  
  
  
      &lt;div class="container"&gt;
        &lt;div class="section"&gt;
          &lt;div class="row"&gt;
            &lt;div class="col s12 center"&gt;
              &lt;h3&gt;&lt;i class="mdi-content-send brown-text"&gt;&lt;/i&gt;&lt;/h3&gt;
              &lt;h4&gt;How?&lt;/h4&gt;
              &lt;p&gt;by focusing on:&lt;/p&gt;
              &lt;br/&gt;
              &lt;br/&gt;
              &lt;p&gt;Balanced, &lt;span class="purple_accent"&gt;stimulating&lt;/span&gt; designs&lt;/p&gt;&lt;br/&gt;&lt;br/&gt;
              &lt;p&gt;The &lt;span="purple_accent"&gt;psychology&lt;/span&gt; of Target Audience&lt;/p&gt;&lt;br/&gt;&lt;br/&gt;
              &lt;p&gt;Solid Code base that safeguards &lt;span class="purple_accent"&gt;immersion&lt;/span&gt;&lt;/p&gt;
              &lt;p&gt;And most importantly...&lt;/p&gt;&lt;br/&gt;&lt;br/&gt;
              &lt;ul id="staggered-test"&gt;
                &lt;li class="purple_accent s40"&gt;The element of Surpirse&lt;/li&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
  
  
  
      &lt;div class="parallax-container valign-wrapper"&gt;
        &lt;div class="section no-pad-bot"&gt;
          &lt;div class="container"&gt;
            &lt;div class="row center"&gt;
              &lt;h5 class="header col s12 light" style="float: right;"&gt;A website is not a page...&lt;/h5&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="parallax"&gt;&lt;%=image_tag('book.png')%&gt;&lt;/div&gt;
      &lt;/div&gt;
  
  
  
      &lt;div class="parallax-container valign-wrapper" style="height: 900px;"&gt;
        &lt;div class="section no-pad-bot"&gt;
          &lt;div class="container"&gt;
            &lt;div class="row center"&gt;
              &lt;h5 class="header col s12 light" style="float: right;"&gt;It is an experience in the mind of the beholder.&lt;/h5&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;img class="parallax" src="localhost:3000/app/assets/images/brainbanner.gif"&gt;
      &lt;/div&gt;
  
  
  
        &lt;!--  Scripts--&gt;
  
      &lt;script type="text/javascript" src="space.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        var options = [
          {selector: '#staggered-test', offset: 200, callback: 'Materialize.showStaggeredList("#staggered-test", 3000)' }
        ];
        Materialize.scrollFire(options);
  
      &lt;/script&gt;
  </code></pre>
  
  <p>if you would like to see the full repo, please go <a href="https://github.com/nbr625/NicolasDev" rel="nofollow">here</a>. Thank you</p>