MCPcopy Create free account
hub / github.com/ampproject/amphtml / createOverflowElement

Function createOverflowElement

ads/vendors/revcontent.js:138–169  ·  view source on GitHub ↗

* Helper function to create an overflow element if one doesn't exist * @param {!Window} global * @param {!Element} container * @param {number} height

(global, container, height)

Source from the content-addressed store, hash-verified

136 * @param {number} height
137 */
138function createOverflowElement(global, container, height) {
139 const overflow = global.document.createElement('div');
140 overflow.id = 'overflow';
141
142 overflow.addEventListener('click', () => {
143 handleResize(global, container, height);
144 });
145
146 setStyles(overflow, {
147 position: 'absolute',
148 height: `60px`,
149 bottom: '0',
150 left: '0',
151 right: '0',
152 background: 'green',
153 cursor: 'pointer',
154 });
155
156 const indicator = `<svg id="indicator" fill="#ffffff" width="60" height="60" viewBox="0 0 24.00 24.00" xmlns="http://www.w3.org/2000/svg"><path d="M16.939 7.939 12 12.879l-4.939-4.94-2.122 2.122L12 17.121l7.061-7.06z"></path></svg>`;
157
158 const chevron = global.document.createElement('div');
159 setStyles(chevron, {
160 width: '40px',
161 height: '40px',
162 margin: '0 auto',
163 display: 'block',
164 });
165
166 chevron./*OK*/ innerHTML = indicator;
167 overflow.appendChild(chevron);
168 container.appendChild(overflow);
169}
170
171/**
172 * @param {!Window} global

Callers 1

handleResizeDeniedFunction · 0.85

Calls 3

setStylesFunction · 0.90
handleResizeFunction · 0.85
addEventListenerMethod · 0.45

Tested by

no test coverage detected