html - My JavaScript code crashes in Chrome, when script tries to make fixed element visible -
i have added few elements "visibility:hidden; position:fixed;" top of page , reason, when launch script in chrome, makes "#pageoverlay" visible, fails unhide other elements. here js function fails:
function showimage(element) { //locating currentgalleryitemindex (currentgalleryitemindex = firstgalleryitemindex; currentgalleryitemindex <= lastgalleryitemindex; currentgalleryitemindex++) { if (galleryitems[currentgalleryitemindex] === element) break; } //general settings fillpreviewarea(); pageoverlay.style.visibility = "visible"; previewarea.style.visibility = "visible"; previewareacloselink.style.visibility = "visible"; previewareaactive = true; }
the same thing doesn't happen in firefox , ie11 , works in chrome if change "position:fixed;" "position:absolute;"; isn't want use.
the page uses script here:
http://spongebobia.com/spongebob-captures/gallery.php
and actual script here:
http://spongebobia.com/spongebob-captures/scripts/previewarea.js
how make work while keeping "position: fixed;"?
it's "z-index". pageoverlay's css should this:
#pageoverlay { background: gray; width: 100%; height: 100%; z-index: 500; top: 0px; left: 0px; position: fixed; visibility: hidden; z-index: 2; }
and previewareacontainer this:
#previewareacontainer { position: fixed; visibility: hidden; top: 10px; left: 50%; margin-left: -344px; width: 670px; height: 540px; z-index: 3; }
Comments
Post a Comment