Closed jrean closed 7 years ago
Avoid waiting for the DOM to get ready to apply your plugin. Just put your plugin's initialization process right after your select field in the HTML body. That should speed it up.
<script>
$('.square-rating').barrating({
theme: 'bars-square'
});
</script>
Apart from what @Technologeek already suggested, if you're bothered by the select field being visible while your scripts are loading you could also insert the select field into the DOM at the same time as you initialise the plugin... or hide the select field with CSS and show it when your scripts are loaded.
Hi,
Thank you for the awesome work. Wondering, whatever I do, when I load the page I see the dropdown then a few ms later the plugin is initialized and so working.
My final
.js
file is loaded at the end of my page like that:<script src="{{ elixir('js/admin.js') }}" type="text/javascript"></script>
Am I doing something wrong?