Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elements apear only after inspect element

I have just encountered the strangest problem I've ever come across in my humble web developing freelance career. I'm building a web application for a job application site where applicants use their webcams to answer 3 short questions. For this I use a jQuery plugin called ScriptCam which uses Flash to activate the user's webcam. I had this all working just fine but now I have the following problem.

I use jQuery .show() and .hide() to show and hide buttons. One button, a replay button, doesn't show up when calling $("#replay").show(); but DOES show when I right click anywhere in the browser after calling this command and hit "Inspect Element"! I've been searching for what could cause this problem but haven't found anything... What could cause this behavior?

This is how I have defined the button:

<div onclick='replay();' id='replay' class="replay">Replay</div>

This is the button's CSS:

.replay{
    float: left;
    top: 150px;
    left: 60px;
    z-index: 100;
    -webkit-box-shadow: 0 12px 36px -16px rgba(0,0,0,0.5);
    background:url('../img/button-grey.png') no-repeat 100% 100%;
    background-position: center center;
    color: white;
    width: 140px;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    font-family: Archive;
    display: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}

Edit: This is CSS of the button's parent div:

.box{
    margin-left: 100px;
    height: 337px;
    width: 300px;
    float: left;
    text-align: center;
}

I haven't used any delays anywhere and the button really appears only right after I click inspect element somewhere in the browser. I also cannot reproduce this problem anywhere else. Anyone got an idea what could cause this? Any help would be much appreciated, thanks in advance!

Update: It appears that only Safari on Mac is having issues.

Update 2: When moving the button out of it's parent div to directly below the body tag it works as it should! So it's probably a css conflict of the parent div?

Edit: You can see the problem live here, just hit the button "Volgende vraag" en wait for the small video to finish. After that the replay button should appear right above the video.

like image 461
MickvJ Avatar asked Aug 14 '13 22:08

MickvJ


People also ask

Is there a way to edit something with inspect element but keep the change even after refreshing the page?

Permanent Inspect Element. This extension lets you save the changes you make to a static web page using Inspect Element to remain there even after you refresh the page.

How do you show hidden elements in inspect element?

VIEW HIDDEN ELEMENTS: The extension makes visible those elements hidden by the "display:none", "type=hidden", and "visibility=hidden" attributes / styles. To do this hit LazySec's "Show Hidden Elements" button.

Why inspect element is not working?

If your information is loaded by AJAX, your Javascript cant be inspected. HTML loaded by AJAX can be viewed by first open the page where your content will be shown, and after that you can inspect the page. Save this answer.


1 Answers

I've found the solution! The problem is caused by an earlier container div which has the CSS display:none. Although I change that with jQuery's .show() before the problem occurs and it's contents are visible, removing display:none in my CSS makes it work! Thanks for all the great help and suggestions!

like image 161
MickvJ Avatar answered Sep 21 '22 21:09

MickvJ