javascript - Button is not displaying in FireFox -
i using button triggers 4-5 other buttons animation. working fine in chrome not in firefox
i have used fullscreen background video in current project, button, in firefox, when inspect elements, shows there, browser not displaying element @ all.
inspiration taken - http://codepen.io/phenax/
'use strict'; (function (document, win) { var animation_time = 600; var btn_move_limit = 30; var item_showing = false; var classname = { show_items: 'menu--list__show', revolve: 'menu--list__revolve', button_cross: 'bar__crossy' }; var $el = { toggle_btn: document.queryselector('.js-menu--toggle'), menu_items: document.queryselector('.js-menu--list'), items: document.queryselectorall('.js-item') }; var constrain = function constrain(val, lim) { return val > lim ? lim : val < -lim ? -lim : val; }; var setbuttonposition = function setbuttonposition(left, top) { $el.toggle_btn.style.left = constrain(left, btn_move_limit) + 'px'; $el.toggle_btn.style.top = constrain(top, btn_move_limit) + 'px'; }; var showallitems = function showallitems() { var item_menu = $el.menu_items.classlist; item_menu.add(classname.show_items); settimeout(function () { item_menu.add(classname.revolve); $el.toggle_btn.classlist.add(classname.button_cross); item_showing = true; }, animation_time); }; var hideallitems = function hideallitems() { var item_menu = $el.menu_items.classlist; item_menu.remove(classname.revolve); $el.toggle_btn.classlist.remove(classname.button_cross); settimeout(function () { item_menu.remove(classname.show_items); item_showing = false; setbuttonposition(0, 0); }, animation_time); }; var findposrelative = function findposrelative(e) { e = e.pagex ? { pagex: e.pagex, pagey: e.pagey } : e.touches[0]; var offset = { x: win.innerwidth / 2, y: win.innerheight / 2 }; e.pagex = e.pagex - offset.x; e.pagey = e.pagey - offset.y; return e; }; var menubtnclickhandler = function menubtnclickhandler() { if (item_showing) hideallitems(); else showallitems(); }; var itemclick = function itemclick(e) { var item_id = e.target.dataset.id; console.log('item id: ' + item_id); hideallitems(); }; var mousemovement = function mousemovement(e) { var left, top; if (item_showing) { e = findposrelative(e); left = 140 * e.pagex / win.innerwidth; top = 140 * e.pagey / win.innerheight; } else { left = 0; top = 0; } setbuttonposition(left, top); }; document.addeventlistener('domcontentloaded', function () { $el.toggle_btn.addeventlistener('click', menubtnclickhandler); (var = 0; < $el.items.length; i++) { if (window.cp.shouldstopexecution(1)) { break; } $el.items[i].addeventlistener('click', itemclick); } window.cp.exitedloop(1); win.addeventlistener('mousemove', mousemovement); win.addeventlistener('touchmove', mousemovement); }); }(document, window));
.menu--toggle { position: absolute; width: 80px; height: 80px; border-radius: 50%; transform: translatex(-50%); border: none; outline: none; cursor: pointer; left: 0; top: 0; color: #222; z-index: 1; background-image: url("../images/logo/logo.jpg"); background-position: center; background-size: cover; box-shadow: 0 0 0 rgba(204, 169, 44, 0.4); } .menu { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin-top: -80px; filter: url("#svgfilter"); } .menu .item { position: absolute; width: 80px; height: 80px; border-radius: 50%; transform: translatex(-50%); border: none; outline: none; cursor: pointer; left: 0; top: 0; background-color: #ffeb3b; color: #222; } .menu .item { transition: 0.6s ease-in-out; } .menu--toggle { transition: .2s linear; } .menu--toggle .bar { width: 20px; height: 2px; background-color: #222; margin: 5px auto; transition: 0.6s ease-in-out; } .menu--toggle.bar__crossy .bar:nth-child(2) { opacity: 0; } .menu--toggle.bar__crossy .bar:nth-child(1) { transform: translatey(7px) rotate(45deg); } .menu--toggle.bar__crossy .bar:nth-child(3) { transform: translatey(-7px) rotate(-45deg); } .menu--list ul { list-style-type: none; padding: 0; margin: 0; } .menu--list li { position: absolute; width: 60px; height: 80px; transition: 0.6s ease-in-out; transform-origin: 0% 50%; } .menu--list__show .item { margin-left: 60px; } .menu--list__revolve li:nth-child(1) { transform: rotate(90deg); } .menu--list__revolve li:nth-child(1) .item { transform: rotate(270deg); } .menu--list__revolve li:nth-child(2) { transform: rotate(180deg); } .menu--list__revolve li:nth-child(2) .item { transform: rotate(180deg); } .menu--list__revolve li:nth-child(3) { transform: rotate(270deg); } .menu--list__revolve li:nth-child(3) .item { transform: rotate(90deg); } .menu--list__revolve li:nth-child(4) { transform: rotate(360deg); } .menu--list__revolve li:nth-child(4) .item { transform: rotate(0deg); }
<div class="menu"> <nav class="menu--list js-menu--list"> <ul> <li><button type="button" onclick="window.open('https://www.facebook.com/themadhousecafe', '_blank')" class="fa fa-facebook item js-item" data-id="1"></button></li> <li><button type="button" onclick="window.open('http://blog.nomadbaker.com/', '_blank')" class="fa item js-item" data-id="2">blog</button></li> <li><button type="button" onclick="window.open('#', '_blank')" class="item js-item" data-id="3">menu</button></li> <li><button type="button" onclick="window.open('#', '_blank')" class="fa fa-phone item js-item" data-id="4"></button></li> </ul> </nav> <button type="button" class='logo_button menu--toggle js-menu--toggle'> <div class="bar"></div> <div class="bar"></div> <div class="bar"></div> </button> </div>
Comments
Post a Comment