ui.Slider.style

Zwraca styl widżetu ActiveDictionary, który można modyfikować w celu aktualizowania stylów widżetu.

Właściwości, które działają jak ich odpowiedniki w CSS:

  – height, maxHeight, minHeight (np. „100px”)

  – width, maxWidth, minWidth (np. „100px”)

  - padding, margin (np. „4px 4px 4px 4px” lub po prostu „4px”)

  - color, backgroundColor (np. „red” lub „#FF0000”)

  - border (np. '1px solid black')

  - borderColor (np. „red black blue #FF0000”)

  - borderRadius (np. „10px”)

  - borderStyle (np. „solid dashed none dotted”)

  - borderWidth (np. „1px 0px 1px 0px”)

  - fontSize (np. '24px')

  - fontStyle (np. „italic”)

  - fontWeight (np. „bold” lub „100”)

  - fontFamily (np. „monospace” lub „serif”)

  - textAlign (np. „left” lub „center”)

  - textDecoration (np. „underline” lub „line-through”)

  - whiteSpace (np. „nowrap” lub „pre”)

  – shown (prawda lub fałsz)

Obsługiwane właściwości układu niestandardowego (patrz dokumentacja ui.Panel.Layout):

  – rozciąganie („poziome”, „pionowe”, „oba”);

  - position ('top-right', 'top-center', 'top-left', 'bottom-right', ...)

WykorzystanieZwroty
Slider.style()ui.data.ActiveDictionary
ArgumentTypSzczegóły
to: ui.widgetui.WidgetInstancja ui.Widget.

Przykłady

Edytor kodu (JavaScript)

// Define a UI widget and add it to the map.
var widget = ui.Slider({style: {width: '400px'}});
Map.add(widget);

// View the UI widget's style properties; an ActiveDictionary.
print(widget.style());

// ActiveDictionaries are mutable; set a style property.
widget.style().set('backgroundColor', 'E0E0E0');
print(widget.style());

// Define the UI widget's style ActiveDictionary as a variable.
var widgetStyle = widget.style();
print(widgetStyle);

// Set the UI widget's style properties from the ActiveDictionary variable.
widgetStyle.set({border: '5px solid darkgray'});
print(widgetStyle);