Call a function after a first function is ran
<p>I want to hide a div by clicking somewhere on the page but only if the div was first displayed by clicking on the preview.</p>

<p>I have this : </p>

<pre><code>$(function() {  
    $("#videopreview").click(function() {
    $("#videolarge").css({ display: 'block' });
    $("#videopreview").css({ display: 'none' });

        $("#videolarge").click(function(){ return false; });
        $(document).one("click", function() { 
        $("#videolarge").css({ display: 'none' });
        $("#videopreview").css({ display: 'block' });

        });
    });
});
</code></pre>

<p>It runs the two functions in the same time so nothing happened :)</p>

<p>Update:</p>

<pre><code>$(function() {  
$("#videopreview").click(function() {
    $("#videolarge").css({ display: 'block' });
    $("#videopreview").css({ display: 'none' });
});
$("#videolarge").click(function(){ return false; });
$("#videopreview").click(function(){ return false; });
$(document).click(function() { 
    $("#videolarge").css({ display: 'none' });
    $("#videopreview").css({ display: 'block' });
});
});
</code></pre>

<p>I can use remove() but once hidden I can't run it again (what makes sense). How can I handle it ?</p>
