Closed n7k1 closed 10 years ago
This is my jquery in-widget hack:
//change the backgronud color of the widget in the 'Select a template' view
if($('#${wid}').parent("div").attr('class') == 'well') {
$('#${wid}').parent("div").css({"background-color":"red"});
}
//change the backgronud color of the widget in the dashboard view
else if($('#${wid}').parent("div").parent("div").attr('class') == 'well dragbox') {
$('#${wid}').parent("div").parent("div").css({"background-color":"red"});
}
Forgive me if it's ugly. I'm new to jquery.
This is uglier but it works better:
//debug
//console.log($('#${wid}').parent("div").attr('id'));
//console.log($('#${wid}').parent("div").parent("div"));
//change the background color of the widget in the dashboard view
if($('#${wid}').parent("div").parent("div").attr('id').search('dragbox') >= 0) {
$('#${wid}').parent("div").parent("div").css({"background-color":"white"});
}
//change the background color of the widget in the 'Select a template' view
else if($('#${wid}').parent("div").attr('id').search('view') >= 0) {
$('#${wid}').parent("div").css({"background-color":"white"});
}
If you're using the latest and greatest jSlate you can add css to the entire dashboard under settings. Might make it prettier.
Any ideas on how to change the background color of a single widget from within the html template?
This works but changes all the widget backgrounds: