Wednesday, 28 August 2013

Make sure that one javascript gets run before another

Make sure that one javascript gets run before another

I have two javascript-files. That currently both get loaded in the header
<link rel="stylesheet"
href="http://filer.jungrelations.com/beaussometumblr/js/main.js">
<script
src="http://filer.jungrelations.com/beaussometumblr/js/vendor/masonry.pkgd.min.js"></script>
main.js does some manipulation to the order in the DOM. Applies masonry,
an javascript library that positions elements absolutely based on their
order in the DOM. I initiate it using the data-masonry-object-method:
data-masonry-options='{ "columnWidth": 196, "itemSelector": "section",
"gutter": 8, "transitionDuration": 0 }'
Because masonry cares about the order of the html-nodes, It's important
that main.js is run before masonry.js. This is what main.js looks like.
$(document).ready(function() {
$('.stamp1').remove();
});

No comments:

Post a Comment