Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Style dynamic value

Can I apply Style to the output of "Labeled" in the below ?

Manipulate[\[Lambda],
Control@{{\[Lambda], 401,
Style["     \[Lambda]", Black, Bold, 24]},
Range[401, 570, 1],
ControlType -> Slider,
ControlPlacement -> Bottom,
Appearance -> "Labeled",
ImageSize -> 200}]

That is on the right part of the Slider :

enter image description here

like image 858
500 Avatar asked Oct 16 '11 23:10

500


People also ask

How do you pass dynamic value to style in HTML?

color = "red"; you can apply the style change dynamically. Below is a function that turns an element's colour to red when you pass it the element's id . You could also use setAttribute(key, value) to set a style on an element. For example, you could set the colour of an element to red by calling element.

What is a dynamic style?

An element's style can be changed dynamically. Often such a change is made in response to user events, which we discuss in Chapter 11. Such style changes can create many effects, including mouse hover effects, interactive menus, and animations.

How do I apply CSS to dynamic content?

The better way is to add css classes which you want to add and then use addClass to add css dynamically.


1 Answers

You want the option BaseStyle (which appears in Options[Slider]). E.g.

Manipulate[
 Plot[Cos[k x], {x, 0, 2 Pi}, PlotLabel -> "Cosine"], 
 {{k, 1, Style["x", Black, Bold, 24]}, 0, 4, 
  ControlType -> Slider, Appearance -> "Labeled", 
  ControlPlacement -> Bottom, ImageSize -> 200, 
  BaseStyle -> {Red, Large, Italic, FontFamily -> "Times"}}]

cosine

When looking at this I noticed that you can also use the almost undocumented ControlType -> LabeledSlider, just for something different.

like image 52
Simon Avatar answered Oct 03 '22 03:10

Simon