Jump to content

How to change border of an image at runtime?


likemike

Recommended Posts

Hello!

I want to write a border around an image when user clicks the image.

I use this on the OnClick-event:

UnimImage1.JSInterface.JSConfig('cls', ['borderImg']);

where "borderImg" is the corresponding CSS:  

.borderImg img {
  border: red;
  border-style: solid;
  border-width: 4px;
}

I get the error message:

Quote

Config Option: cls "borderImg"<br/> is referring a previous request, <br/> it's not allowed in AJAX request or JS handler. Use equivalent Public Property  or Method instead.

When I set the JSConfig on the OnCreate-event of the image, all works fine. 

So the question is: How can I change the CSS during runtime.

Thanks in advance

Mike

Link to comment
Share on other sites

1 hour ago, likemike said:

I think, that CSS is only assignable during creation

No.

 

2 hours ago, likemike said:

JSConfig

Should be used when initializing a component.

 

In runtime, you can try to use JSCall, for example:

  with UnimImage.JSInterface do
    JSCall('addCls', ['borderImg'])

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...