javascript - external js not loading -
i'm trying codepen code working locally:
http://codepen.io/desandro/pen/mcdbd/
however, when try load js external script, not work:
<!doctype html> <html lang = "en"> <script src="isotope.pkgd.js"></script> <script src="jquery.min.js"></script> <script src="isotopes.js"></script>
but if copy paste file markup:
<!doctype html> <html lang = "en"> <script src="jquery.min.js"></script> <script src="isotope.pkgd.js"></script> <script> $( function() { // quick search regex var qsregex; var buttonfilter; // init isotope var $container = $('.isotope').isotope({ itemselector: '.element-item', layoutmode: 'fitrows', filter: function() { var $this = $(this); var searchresult = qsregex ? $this.text().match( qsregex ) : true; var buttonresult = buttonfilter ? $this.is( buttonfilter ) : true; return searchresult && buttonresult; } }); $('#filters').on( 'click', 'button', function() { buttonfilter = $( ).attr('data-filter'); $container.isotope(); }); // use value of search field filter var $quicksearch = $('#quicksearch').keyup( debounce( function() { qsregex = new regexp( $quicksearch.val(), 'gi' ); $container.isotope(); }) ); // change is-checked class on buttons $('.button-group').each( function( i, buttongroup ) { var $buttongroup = $( buttongroup ); $buttongroup.on( 'click', 'button', function() { $buttongroup.find('.is-checked').removeclass('is-checked'); $( ).addclass('is-checked'); }); }); }); // debounce filtering doesn't happen every millisecond function debounce( fn, threshold ) { var timeout; return function debounced() { if ( timeout ) { cleartimeout( timeout ); } function delayed() { fn(); timeout = null; } settimeout( delayed, threshold || 100 ); }; } </script> <link rel = "stylesheet" type= "text/css" href = "style.css"> <h1>isotope - filtering search field , button filters</h1>...
then work sometimes. explain how external js file loading?
the type attribute required in html 4.01 (source: http://www.w3schools.com/tags/tag_script.asp).
<script type="text/javascript" src="file.js"></script>
Comments
Post a Comment