Loading .css files to mods?

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.

1 Like

Yeah but how? I’m making a button named blueButtonMB , which replaces orangeButton in an UI. How to load CSS from Javascript files, idk.

I already told you.

This website gives you a more detailed explanation.

1 Like

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">');
3 Likes

Thanks guys :stuck_out_tongue:

Wait, so the CSS isnt supposed to use GDT.getRelativePath()? What would happen if you post it to the workshop?

1 Like

Worked!

Check this out!

1 Like

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.

1 Like

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?

1 Like

You should not make an API with this. If you dont like using UltimateLib, why would you create even more API’s? :slight_smile: Nontheless, it is such simple code that it wouldn’t be necessary in the first place.

1 Like

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.

1 Like

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 :stuck_out_tongue: Nothing wrong about that, its just that there are too many libraries out there and libraries are annoying.

1 Like

Don’t worry. Since I know it uses jQuery now, I will make more to it.

Like what, if I may ask?

1 Like

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.

2 Likes