Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. function createArrow() {
  2. var arrowDown = {
  3. parent: document.querySelector('.landingItem'),
  4. div: document.createElement('div'),
  5. initDiv: function() {
  6. this.div.classList.add('arrow-down');
  7. this.div.style.borderLeftWidth = parseInt(document.documentElement.clientWidth)/2 + 'px';
  8. this.div.style.borderRightWidth = parseInt(document.documentElement.clientWidth)/2 + 'px';
  9. this.parent.appendChild(this.div);
  10. },
  11. checkDiv: function () {
  12. if(this.parent.querySelector('.arrow-down')) {
  13. this.parent.removeChild(this.parent.querySelector('.arrow-down'));
  14. }
  15. this.initDiv();
  16. }
  17.  
  18. };
  19.  
  20. arrowDown.checkDiv();
  21.  
  22. .arrow-down {
  23. margin-top: -2px;
  24. border-top: 60px solid #501a70;
  25. border-left: 160px solid transparent;
  26. border-right: 160px solid transparent;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement