Created
June 30, 2018 07:02
-
-
Save yu-smc/a015655df6cd9d9c429bb3350cd451e3 to your computer and use it in GitHub Desktop.
hoge
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('turbolinks:load', function() { | |
$(function (){ | |
$('#prototype_captured_images_attributes_0_content').on('change',function previewFile(e) { | |
var preview = $("#selected_image") | |
var file = e.target.files[0]; | |
var reader = new FileReader(); | |
reader.onloadend = function () { | |
preview.src = reader.result; | |
$("#selected_image").attr("src", preview.src); | |
} | |
if (file) { | |
reader.readAsDataURL(file); | |
} else { | |
preview.src = ""; | |
} | |
}); | |
}); | |
$(function(){ | |
$('.cover-image-upload').on('mouseenter', function(){ | |
$(this).css("background-color","rgba(255, 175, 45, 0.4)") | |
}) | |
$('.cover-image-upload').on('mouseleave', function(){ | |
$(this).css("background-color","#ffffff") | |
}) | |
}); | |
$(function(){ | |
$('#prototype_captured_images_attributes_0_content').on('change', function(){ | |
$('#show_selected_image').remove(); | |
} | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment