Daniel king• 210
@thedanielking
Posted
Nice work man. I had the same issue concerning the image since from the solution it appears to be cropped. I like you JavaScript as well. Could you by chance in a line explain the condition for your JavaScript ?
1
Raptor0x1• 210
@Raptor0x1
Posted
Sure. When the button is clicked, if the display of shareContainer is set to none then display property would change to block and the other properties would also change.
- if it's not set to none which means it would be block then the display would change to none (If its visible then it would get hide) and the other properties will also change.
- By default, JavaScript will check inline style in this piece of code
shareContainer.style.display
but I have set the display property in an external CSS file so it's going to return an empty string. So I had to explicitly set the valueshareContainer.style.display = 'none'
- If you want you can set the display in inline style and then remove the value in js OR you could use getComputedStyle to directly fetch the display property from the external CSS
getComputedStyle(shareContainer).display =='none'
0