summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2016-04-29 08:03:57 -0700
committerAaron Parecki <aaron@parecki.com>2016-04-29 08:03:57 -0700
commit3cd68c5331b7808a970c67119cdf9a7389b92cdb (patch)
treedfdde90db7e0e5921dd8dd578bc9f1554ff1f669
parent3ea51af407501d70ad24ad12c20ccd904e294022 (diff)
hide remove photo button before JS loads
-rw-r--r--views/new-post.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/views/new-post.php b/views/new-post.php
index 8e9c692..6ae4a17 100644
--- a/views/new-post.php
+++ b/views/new-post.php
@@ -28,9 +28,11 @@
<label for="note_photo"><code>photo</code></label>
<input type="file" name="note_photo" id="note_photo" accept="image/*">
<br>
- <div id="photo_preview_container">
+ <div id="photo_preview_container" class="hidden">
<img src="" id="photo_preview" style="max-width: 300px; max-height: 300px;">
- <button type="button" class="btn btn-danger btn-sm" id="remove_photo"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Remove image</button>
+ <div>
+ <button type="button" class="btn btn-danger btn-sm" id="remove_photo"><span class="glyphicon glyphicon-trash" aria-hidden="true"></span> Remove image</button>
+ </div>
</div>
</div>
@@ -139,15 +141,15 @@ $(function(){
var userHasSetCategory = false;
- $("#photo_preview_container").hide();
+ $("#photo_preview_container").addClass("hidden");
$("#note_photo").on("change", function(e){
- $("#photo_preview_container").show();
+ $("#photo_preview_container").removeClass("hidden");
$("#photo_preview").attr("src", URL.createObjectURL(e.target.files[0]) );
});
$("#remove_photo").on("click", function(){
$("#note_photo").val("");
$("#photo_preview").attr("src", "" );
- $("#photo_preview_container").hide();
+ $("#photo_preview_container").addClass("hidden");
});
$("#note_content").on('change keyup', function(e){