Orange rectangle around button and menu list does not disappear

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

teslaball
Posts: 7
Joined: Wed Jan 25, 2017 2:32 pm

Orange rectangle around button and menu list does not disappear

Post by teslaball »

Hello people,

I am new to this forum and need help on Photoshop CC2017 HTML5 extension that I am building.

The dropdown menu is working as expected, but actually there are two problems left, the first problem is when clicking on the dropdown button it is framed in an orange rectangle which I want to get rid of it and the second problem is when a menu list is opened, it disappears only when clicked in the area of the extension, but when clicking outside in an area somewhere else in Photoshop, it stays open which I want it to disappear.

Can someone do the trick for these two problems being solved please?

Here's the code example in Javascript:

Code: Select all


    //dropdown  
function dropdown_one(btn) {
document.getElementById("menu_list").classList.toggle("dcontent");
btn.classList.toggle("button-selected");
}
//condition
window.onclick = function(event) {
if (!event.target.matches('.button')) {

var menu = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < menu.length; i++) {
var open_list = menu[i];
if (open_list.classList.contains('dcontent')) {
open_list.classList.remove('dcontent');
}
}
var selected = document.getElementsByClassName("button-selected");
for (var i = 0, len = selected.length; i < len; i++) {
selected[i].classList.remove("button-selected");
}
}
}
Thanks,
teslaball
teslaball
Posts: 7
Joined: Wed Jan 25, 2017 2:32 pm

Re: Orange rectangle around button and menu list does not disappear

Post by teslaball »

Is there anyone who could help me in solving this problem? I think solving this problem isn't hard at all for the experienced.
User avatar
txuku
Posts: 136
Joined: Thu Jan 01, 1970 12:00 am

Re: Orange rectangle around button and menu list does not disappear

Post by txuku »

Bonjour

It seems to me that you do not provide all the elements necessary to the execution of this script ???

For me ; Error2
Windows is not defined line 7
teslaball
Posts: 7
Joined: Wed Jan 25, 2017 2:32 pm

Re: Orange rectangle around button and menu list does not disappear

Post by teslaball »

txuku wrote:Bonjour

It seems to me that you do not provide all the elements necessary to the execution of this script ???

For me ; Error2
Windows is not defined line 7
Do you need the HTML+CSS code?
The code works perfectly inside PS, only the annoying orange rectangle and clicking outside the extension the dropdown won't disappear.