flip image 추가

This commit is contained in:
2018-09-24 04:17:54 +09:00
parent c34e44c4ec
commit 422b3be0c5
2 changed files with 42 additions and 1 deletions
+39
View File
@@ -143,6 +143,41 @@ function getIconPath(imgsvr, picture){
} }
} }
function activeFlip($obj){
var $result;
if($obj === undefined){
$result = $('img[data-flip]');
}
else{
$result = $obj.find('img[data-flip]');
}
$result.each(function(){
activeFlipItem($(this));
});
}
function activeFlipItem($img){
var imageList = [];
imageList.push($img.attr('src'));
imageList = imageList.concat($img.data('flip').split(','));
if(imageList.length <= 1){
return;
}
$img.data('computed_flip_array', imageList);
$img.data('computed_flip_idx', 0);
$img.click(function(){
var arr = $img.data('computed_flip_array');
var idx = $img.data('computed_flip_idx');
idx = (idx + 1)%(arr.length);
$img.attr('src', arr[idx]);
$img.data('computed_flip_idx', idx);
});
$img.css('cursor','pointer');
}
jQuery(function($){ jQuery(function($){
$('.obj_tooltip').each(function(){ $('.obj_tooltip').each(function(){
var $objTooltip = $(this); var $objTooltip = $(this);
@@ -164,10 +199,14 @@ jQuery(function($){
}); });
activeFlip();
var customCSS = localStorage.getItem('sam_customCSS'); var customCSS = localStorage.getItem('sam_customCSS');
if(customCSS){ if(customCSS){
var $style = $('<style type="text/css"></style>'); var $style = $('<style type="text/css"></style>');
$style.text(customCSS); $style.text(customCSS);
$style.appendTo($('head')); $style.appendTo($('head'));
} }
}); });
+3 -1
View File
@@ -20,7 +20,7 @@ jQuery(function($){
if(!inputText || inputText == '<p></p>'){ if(!inputText || inputText == '<p></p>'){
inputText = '<p><br></p>'; inputText = '<p><br></p>';
} }
console.log(inputText);
$editForm.removeClass('viewer').summernote({ $editForm.removeClass('viewer').summernote({
minHeight:200, minHeight:200,
maxHeight:null, maxHeight:null,
@@ -97,10 +97,12 @@ jQuery(function($){
$editForm.summernote('destroy'); $editForm.summernote('destroy');
$cancelEdit.hide(); $cancelEdit.hide();
$editForm.html($noticeInput.val()).addClass('viewer'); $editForm.html($noticeInput.val()).addClass('viewer');
activeFlip($editForm);
} }
$cancelEdit.hide(); $cancelEdit.hide();
$editForm.html($noticeInput.val()); $editForm.html($noticeInput.val());
activeFlip($editForm);
if(editable){ if(editable){
$submitBtn.prop('disabled', false); $submitBtn.prop('disabled', false);
} }