Reputation: 5405
I'm struggling myself in a apparently solution-less problem.
I'm writing a jQuery cart for a customer (see a demo here: http://thisisnot2.fornacestudio.com/prodotto ).
The cart script is working heavily manipulating dom elements. The problem is that after posting the order to the form page, if you hit the back button in the browser in Chrome the script stops working (for example: categories don't reveal their content after being clicked).
Does someone know what could cause this?
Thanks!
Upvotes: 0
Views: 518
Reputation: 4520
Well if you didn't know the error is coming from line 351 in suchi-cart.js
jQuery(this).find(".category-content").modal( ... );
In the form of object has no method 'modal'
, I haven't figured out why exactly since I see the script included on the page when hitting the page initially with a hard refresh and when navigating away and going back.
Edit:
Upon looking into the script more I noticed your using a lazyload
at the top of the page to including jQuery 1.6.2 via google https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
Then in your head tag you also load a local copy of jQuery 1.6.1 via
<script type='text/javascript' src='http://thisisnot2.fornacestudio.com/wp-includes/js/jquery/jquery.js?ver=1.6.1'></script>
Finally at the very bottom of the page you include your simplemodal script via
<script type="text/javascript" src="http://thisisnot2.fornacestudio.com/wp-content/themes/notatemplate/cart/jquery.simplemodal.1.4.1.min.js"></script>
My theory is on a hard refresh of the page the two jQuery scripts are loading first followed by the loading for the simplemodel script which of course extends its .model()
method and what not onto the jQuery object.
But when you leave the page and go back the scripts loaded via <script>
jQuery 1.6.1 and simplemodel plugin load instantly but the LazyLoad'd include of jQuery 1.6.2 via Google doesn't run through cache since its a script and thus is loading after the first two scripts overwriting the jQuery object to 1.6.2 and removing the simplemodal script loaded into the object.
So you need to remove lazy loading jQuery from your page.
Upvotes: 1