fgnass / spin.js

A spinning activity indicator
http://spin.js.org
MIT License
9.3k stars 1.02k forks source link

Add spinner background option #348

Closed ttodua closed 4 years ago

ttodua commented 6 years ago

It will be nice if you just add the blackground (like the jquery-ui dialog with "modal:true" parameter), to make the dark background during the spinner spins.

at this moment we have to use some custom codes and annoying;

$("body").append('<div id="blackground_spinner" style="width:100%;height:100%;position:fixed;background:white; z-index:12; opacity:0.8;"></div>');
my_spinner = new Spinner(opts).spin();
$("body").append(my_spinner.el);

//remove:
$("#blackground_spinner").remove();
my_spinner_sampleTT.el.remove();

so, why wont you just give us simple option, i.e. { ..... background: #e7e7e725; //so, this contains opacity too: the last 25 means alpha opacity. }

theodorejb commented 4 years ago

For one thing I don't think the suggested API makes sense (appending an opacity percentage to a hex color string). It would be better to have separate properties for background color and opacity.

But ultimately a feature like this is outside the scope of spin.js. It would add a size and maintenance cost, and wouldn't be useful for people who want to animate the background or add other content to it. I would suggest writing your own function or library for this if you use this pattern in multiple places.

ttodua commented 4 years ago

thanks for answering, but, i can't clearly understand what maintenance costs or sizes are being talked - 300 bytes? and moreover, in all sites almost, where there is shown spinner/waiter , the background is dimmed. so, dimming a background when waiter is shown, is (imho) a standard practice and "more like to happen", so adding 300 bytes for quite useful feature, would have been nice. (probably even if out of scope, would have been just nice to have that too). one user (as of me) says this as his usage case of your product (and there might be many who just didnt open this topic, but wished same). but you are maintainer and you make decision. you know it better. regards anyway. nice work. thanks