Change color of objects in Lectora

mkia Community Member Posts: 38

i'm trying to figure out if there a way to change the color of an object by using some kind of action.

For example rectangle is grayish but when the user clicks depending on what was the content of that rectangle it becomes different color.

Any ideas simpler then having a double rectangle?



  • ssneg
    ssneg Community Member Posts: 1,466 ☆ Roadie ☆
    Use External HTML Object (HTML Extension), set it to Custom DIV, write any code inside. E.g.
    <div id="mydiv1" style="background-color:red; width:333px;height:222px"></div>

    Then you will be able to programmatically change its background with JS:

    document.getElementById(&#039;mydiv1&#039;).style.backgroundColor = "blue";
  • amwdmw
    amwdmw Community Member Posts: 97
    I just use two different objects, and use the Change Contents feature...or Show/Hide if the items aren't the same size.  You can use the "On Mouse Click" action to trigger these events.  :)
  • mkia
    mkia Community Member Posts: 38
    Thanks @ssneg and @amwdmw


    I have tried change contents already...but it cannot be applied to my objects. I've solved it temporarily by having two objects one over the other and the other is transparent so the content is the same and just the frame color changes...but I'm sure there is more elegant way to do this...:))

    Sergey's way sounds pretty cool if only I would know more about Java...:)) It's def on my goodtoinvestsometime list! I'll try to play with it a bit more these days.