Ignore parent onclick when child onclick is clicked, using Javascript only

前端 未结 2 918
挽巷
挽巷 2020-12-21 04:57

An good example of what im trying to do is, think of instragram. When you are click on a photo, it opens a window with that photo plus the grey background. If you click anyw

2条回答
  •  猫巷女王i
    2020-12-21 05:20

    You perhaps can take an inner div which is absolute that has the background and certain height and width which is equal to main parent div and that has all the style, so on click of that div you may close parent div and on image you need not to do anything.

    So childdiv should have display none functionality. With JavaScript, you should be able to close parent div on a click of child div.

提交回复
热议问题