Created
May 31, 2017 11:17
-
-
Save anonymous/7160a79486a3d6052b9efa778a1515cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //функция закрытия попапов по клику вне его | |
| var closeNote = function(elem) { | |
| $(document).mouseup(function(e) { | |
| var container = $(elem).find(".cibkpi__note"); | |
| if (!container.is(e.target) && container.has(e.target).length === 0) | |
| { | |
| console.log("call Event"); | |
| console.log(elem); | |
| container.removeClass("cibkpi__note--show"); | |
| document.removeEventListener("click", closeNote()); | |
| } | |
| }); | |
| } | |
| //открытие заметок по клику | |
| $("a").each(function(i, elem) { | |
| $(elem).on("click", function(evt) { | |
| if((evt.target === elem.querySelector('.cibkpi__title'))|| | |
| (evt.target === elem.querySelector('.cibkpi__note-btn'))) { | |
| evt.preventDefault(); | |
| $(elem).find('.cibkpi__note').toggleClass('cibkpi__note--show'); | |
| $(elem).find(".cibkpi__note-btn").toggleClass("cibkpi__note-btn--checked"); | |
| document.addEventListener("click", closeNote(elem)); | |
| console.log("added Event") | |
| } | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment