Hello, I want to load a .css file to my mod. I’m trying to make it to add new custom buttons. Any ideas how to add a css file into a mod? I don’t think loadJs will work.
I told you that in your divs there is only HTML. Simply load your css spreadsheet I think. Wont promise it’ll work, but probably.
Yeah but how? I’m making a button named blueButtonMB , which replaces orangeButton in an UI. How to load CSS from Javascript files, idk.
Super simple code, just add a link reference to your style sheet straight to the head using jQuery.
$("head").append('<link rel="stylesheet" type="text/css" href="./mods/YOURMOD/myCss.css">');
Thanks guys
Wait, so the CSS isnt supposed to use GDT.getRelativePath()? What would happen if you post it to the workshop?
Worked!
Check this out!
Hmm, no idea.
Doesn’t matter in this case because the file path is being read from the HTML markup which will use the path where the current html file is located.
Thanks to you guys, will make this an API like thingy. Or pull request to the original. Advanced modders like you would definitely use this feature, right? Maybe?
You should not make an API with this. If you dont like using UltimateLib, why would you create even more API’s? Nontheless, it is such simple code that it wouldn’t be necessary in the first place.
Maybe. Didn’t know UL used CSS at the first place. Only used one to make some achievements, that’s all.
I never said that UltimateLib uses CSS, but its really way too simple to be added into a library.
Alright. Alright.
Nothing mean to it, but it seems like you want to create your own library with all the functions you learn from others Nothing wrong about that, its just that there are too many libraries out there and libraries are annoying.
Don’t worry. Since I know it uses jQuery now, I will make more to it.
Like what, if I may ask?
New borders, for example. Make them either blue, red etc. New color backrounds.
this can’t work if it’s a workshop mod since it’s under ./mods_ws
I think you have to use GDT.getRelativePath() in this case.