简体   繁体   中英

JavaScript only working after Refreshing Page multiple times

My JavaScript only starts working when I refresh my page multiple times.

Please check out the following code -

<div class="col-xs-6 col-sm-3  js--isotope-target  js--cat-2" data-price="14.36" data-rating="4">
  <div class="products__single">
<figure class="products__image">
  <a href="single-product.html">
    <img alt="#" class="product__image" width="263" height="334" src="images/dummy/w263/2.jpg">
  </a>
  <div class="product-overlay">
    <a class="product-overlay__more" href="single-product.html">
      <span class="glyphicon glyphicon-search"></span>
    </a>

    <div class="product-overlay__stock">
      <span class="in-stock">&bull;</span> <span class="in-stock--text">In stock</span>
    </div>
  </div>
</figure>
<div class="row">
  <div class="col-xs-9">
    <h5 class="products__title">
      <a class="products__link  js--isotope-title" href="single-product.html">Moringa Powder</a>
    </h5>
     </div>
    </div>
    <div class="products__category">
  Powders
    </div>
   </div>
  </div>

I had tried resetting the browser Javacript (Disabling then Enabling it again) but nothing worked, The JavaScript never works the first the page is loaded, I have to always Refresh the page multiple times to get the javascript working!

add ver to your JavaScript file. like this. myjava.js to myjava.js?v=1.0

every time change the ver. if any changes in your .js file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM