Search code examples
sidebardhtmlx

Colorize dhtmlxSidebar


I have 2 dhtmlxSidebars like in a sample here How can I set a different background color to the nested one? If I add css

.dhxsidebar_side {
    background-color: # 427C9C !important;
}

it apply changes for both backgrounds…


Solution

  • In your case the main one will be first element [0] and nested - second [1]: (i've set different blue colors)

    document.getElementsByClassName("dhxsidebar_side")[0].style.backgroundColor = "#add8e6";
    document.getElementsByClassName("dhxsidebar_side")[1].style.backgroundColor = "#d5f2fc";
    

    Also you can apply simple and selected items bg color the next way:

    .dhxsidebar_item {
    background-color: #ffffff !important;
    }
    .dhxsidebar_item_selected {
    background-color: #b5deff !important;
    }