Created
May 4, 2018 12:25
-
-
Save ratelChief/54c6a32ccb80c0ef7fe627c23d38717b to your computer and use it in GitHub Desktop.
This file contains 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
window.pin = (function () { | |
createPinElement: function (ad, template) { | |
var pinElement = template.cloneNode(true); | |
var imageElement = pinElement.querySelector('img'); | |
pinElement.style.left = (ad.location.x - window.data.MAIN_PIN_SHARP_END) + 'px'; | |
pinElement.style.top = (ad.location.y - window.data.MAIN_PIN_SIZE) + 'px'; | |
pinElement.dataset.indexOfPin = ad.index; | |
imageElement.src = ad.author.avatar; | |
imageElement.alt = ad.offer.title; | |
return pinElement; | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
В результате выполнения этого кода у тебя в
window.pin
будeтundefined
, потому что в переменную присвоится результат выполнения IIFE, а она у тебя ничего не возвращает.