Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- (function(){
- var data = 0
- window.renderPin = function (array) {
- data = array
- var PIN_IMG_SIZE = 40;
- var PIN_WIDTH = 56;
- var PIN_HEIGHT = 75;
- var fragmentTag = document.createDocumentFragment();
- var tokyoPinMap = document.querySelector('.tokyo__pin-map');
- for (var i = 0; i < array.length; i++) {
- var blockTag = document.createElement('div');
- var img = document.createElement('img');
- blockTag.className = 'pin';
- blockTag.setAttribute('style', 'left:' + (array[i].location.x - (Math.ceil(PIN_WIDTH) / 2))
- + 'px;top:' + (array[i].location.y - Math.ceil(PIN_HEIGHT)) + 'px');
- blockTag.setAttribute('id', 'pin-id-' + (i + 1));
- blockTag.setAttribute('data-pincount', (i + 1));
- blockTag.setAttribute('tabindex', 0);
- img.className = 'rounded';
- img.setAttribute('src', array[i].author.avatar);
- img.setAttribute('width', PIN_IMG_SIZE);
- img.setAttribute('height', PIN_IMG_SIZE);
- blockTag.appendChild(img);
- fragmentTag.appendChild(blockTag);
- }
- tokyoPinMap.appendChild(fragmentTag);
- return{
- data: 3
- }
- }
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement