fixed js to detect if open close state