Description Usage Arguments Details Value Examples
Add additional buttons to the viewer and pass in JavaScript functions to enable additional actions to be done when the button is clicked (such as styling changes to the model). You can also use css flex layout to control the layout of all added buttons.
1 2 3 4 5 6 7 8 |
id |
R3dmol |
name |
Name for button. |
label |
Label for button. |
func |
The function executed when the button is clicked. |
align_items |
The css |
justify_content |
The css |
If more than one button is set, only the layout
(justify-content
and align-items
) of the first button will be
used.
R3dmol id
or a r3dmol
object (the output from
r3dmol()
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | library(r3dmol)
r3dmol() %>%
m_add_model(data = pdb_1j72, format = "pdb") %>%
m_zoom_to() %>%
m_button(
name = "cartoon",
label = "Cartoon",
align_items = "flex-end",
justify_content = "center",
func = "
function() {
viewer.setStyle({cartoon:{}});
viewer.render();
}
"
) %>%
m_button(
name = "stick",
label = "Stick",
func = "
function() {
viewer.setStyle({stick:{}});
viewer.render();
}
"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.