diff --git a/css/style.css b/css/style.css index b6664c72464f5626ca1d9b3e77afb22ad4388f55..0f8910d15a9e6cca809722be3a02568819e47e47 100644 --- a/css/style.css +++ b/css/style.css @@ -419,6 +419,7 @@ script { transform : translate(-50%, 0) ; overflow : hidden ; white-space : nowrap ; + pointer-events : all ; } #phone-toolbar > .btn-group.fixed-bottom { diff --git a/fixed_move_test.html b/fixed_move_test.html index f8375d6501242b4f755dfeb4b5d9c90d085f7d76..a40a438a3570727e34f2d458d3fa399ec6c6043a 100644 --- a/fixed_move_test.html +++ b/fixed_move_test.html @@ -3,11 +3,16 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style> + /* Wrapper class to trigger the effect */ .trigger { width : 220px ; border : 1px solid #000 ; display : inline-block ; } + .trigger:hover .container{ + left : 200px ; + } + /* Absolutely positionned element */ .container { position : relative ; width : 20px ; @@ -16,21 +21,21 @@ background : #aaa ; transition : all .25s ease-out ; } - .trigger:hover .container{ - left : 200px ; - } + /* Fixed element inside the absolute one */ .child { position : fixed ; width : 20px ; height : 20px ; background : #aaa ; - top : 80px ; + top : 100px ; } </style> </head> <body> - Your brother has the bug : <span id='bug-status'></span><br/> + <!-- Display the bug test result --> + Your brother has the bug : <span id='bug-status'></span><br/><br/> <div class="trigger"> + <!-- Demonstrate the error without any fix --> <span>Reference</span><br/> <div class="container"> <div class="child"> @@ -38,6 +43,7 @@ </div> </div> </div> + <!-- Apply the fix fix --> <div class="trigger" id="trigger"> <span>Fixed</span><br/> <div class="container" id="container"> @@ -48,6 +54,7 @@ </div> </body> <script> + /* Fix to programatically force fixed element repositionning */ var trigger = document.getElementById('trigger') ; var container = document.getElementById('container') ; var child = document.getElementById('child') ; @@ -60,25 +67,32 @@ trigger.addEventListener('mouseenter', from_and_back) ; trigger.addEventListener('mouseleave', from_and_back) ; + /* Simulate the bug to check whether the browser experiences it */ var bug_status = document.getElementById('bug-status') ; bug_status.innerText = (function() { + //create an absolutely positionned element var abs = document.createElement('div') ; abs.style.position = 'relative' ; abs.style.left = '0px' ; + //create a fixed element to put inside var fix = document.createElement('div') ; fix.style.position = 'fixed' ; + //insert it into the document abs.appendChild(fix) ; document.body.appendChild(abs) ; + //test fix.getBoundingClientRect() ; abs.style.left = '20px' ; - var fix_left = fix.getBoundingClientRect().left ; var abs_left = abs.getBoundingClientRect().left ; + + //remove test elements from the document document.body.removeChild(abs) ; + //send the result return abs_left !== fix_left ; })() ; </script> diff --git a/js/pgm_construction.js b/js/pgm_construction.js index 554deb123dfb6724e2f2f06437ca16fd1f36da0f..2b27256b6e692f6384ead279ecedc1c0b4f78512 100644 --- a/js/pgm_construction.js +++ b/js/pgm_construction.js @@ -54,8 +54,6 @@ var has_absolute_fixed_bug = (function() { return child_left !== container_left; })() ; -console.log(has_absolute_fixed_bug) ; - /*}}}*/ /* {{{ Load and save ======================================================== */ @@ -1046,10 +1044,12 @@ function phone_tools_get() { } function phone_tools_update() { - var child = phone_toolbar.children[0] ; - if(child) { - phone_toolbar.removeChild(child) ; - setTimeout(function() {phone_toolbar.appendChild(child);}, 250) ; + if(has_absolute_fixed_bug) { + var child = phone_toolbar.children[0] ; + if(child) { + phone_toolbar.removeChild(child) ; + setTimeout(function() {phone_toolbar.appendChild(child);}, 250) ; + } } }