At least for the moment, assume you are only loading style sheets during document load. Then, you can do the following:
function checkLoadedSheetsForHref(href) {
for (var i = 0; i < document.styleSheets.length; ++i) {
if (document.styleSheets[i].href == href) {
// or if you just want to check the filename, check if href contains it:
// if (document.styleSheets[i].href.indexOf(href) != -1) {
return true;
}
}
return false;
}
document.onload = function() {
if (checkLoadedSheetsForHref("assets/js/slider.js")) {
// enable whatever js you want
}
}
If you have something that dynamically loads style sheets, you could set timers to wait for the sheet to load, or add an onload
to whatever is adding it, or just check the string you're loading.