mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/region-edoc.git
synced 2026-01-24 04:55:39 +03:00
Поправлена структура, разделы в подразделы до 3.3
This commit is contained in:
66
ИЭТР-тест/Develop/app/js/customUploader/common.js
Normal file
66
ИЭТР-тест/Develop/app/js/customUploader/common.js
Normal file
@@ -0,0 +1,66 @@
|
||||
$( document ).ready(function() {
|
||||
//Custom file upload
|
||||
|
||||
$.fn.customFileInput = function(){
|
||||
var fileInput = $(this);
|
||||
|
||||
fileInput.val('');
|
||||
fileInput.each(function() {
|
||||
var el = $(this);
|
||||
var defText = 'Перетащите сюда ваш файл';
|
||||
var upload = $('<div class="custom_upload"></div>', el);
|
||||
var uploadFeedback = $('<div class="custom_upload_button TABLE_type"><div><p><div class="i_upload-1"></div>'+defText+'</p></div></div>', el).appendTo(upload);
|
||||
|
||||
el.bind('change',function() {
|
||||
var fileName = $(this).val().split(/\\/).pop();
|
||||
var fileExt = 'custom_upload_ext-' + fileName.split('.').pop().toLowerCase();
|
||||
|
||||
uploadFeedback
|
||||
.html('<div><p>'+fileName+'</p></div>')
|
||||
.removeClass(uploadFeedback.data('fileExt') || '')
|
||||
.addClass('file_selected');
|
||||
|
||||
if( $(this).parent('.custom_upload').find('.input').val() == '' )
|
||||
$('.custom_upload_button', this).removeClass('file_selected').html('<div><p><div class="i_upload-1"></div>'+defText+'</p></div>');
|
||||
|
||||
if( $('.custom_upload_multiple .custom_upload_wrap input').val() !== '' ) {
|
||||
$(this).after('<div class="custom_upload_disable"></div>');
|
||||
$('.custom_upload_multiple').append('<div class="custom_upload_wrap"><input type="file" value="" name="upl[]"></div>');
|
||||
$('.custom_upload_multiple').find('.custom_upload_wrap:last').hide(0);
|
||||
$('.custom_upload_multiple').find('.custom_upload_wrap:last').fadeIn(400);
|
||||
$('.custom_upload_multiple').find('.custom_upload_wrap:last').find('input').customFileInput();
|
||||
}
|
||||
|
||||
if(uploadFeedback.hasClass('file_selected')) {
|
||||
upload.find('.custom_upload_delete').fadeIn(400);
|
||||
}
|
||||
else upload.find('.custom_upload_delete').hide(0);
|
||||
});
|
||||
|
||||
upload.mousemove(function(e) {
|
||||
el.css({ 'left' : e.pageX - $(this).offset().left - el.outerWidth(true) + 30 });
|
||||
}).insertAfter(el);
|
||||
|
||||
el.appendTo(upload);
|
||||
|
||||
upload.append('<div class="custom_upload_delete"></div>');
|
||||
upload.find('.custom_upload_delete').hide(0);
|
||||
|
||||
$('.custom_upload_delete').click(function(){
|
||||
$(this).parent('.custom_upload').find('.input').val('');
|
||||
$(this).parent('.custom_upload').find('.custom_upload_button').removeClass('file_selected').html('<i class="i_upload-1"></i><p>'+defText+'</p>');
|
||||
$(this).hide(0);
|
||||
});
|
||||
|
||||
$('.custom_upload_multiple .custom_upload_delete').click(function(){
|
||||
$(this).parents('.custom_upload_wrap').remove();
|
||||
});
|
||||
});
|
||||
return $(this);
|
||||
};
|
||||
|
||||
$('.custom_upload_wrap').each(function(index, element) {
|
||||
$('input', this).customFileInput();
|
||||
});
|
||||
|
||||
});
|
||||
BIN
ИЭТР-тест/Develop/app/js/customUploader/images/close.png
Normal file
BIN
ИЭТР-тест/Develop/app/js/customUploader/images/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
35
ИЭТР-тест/Develop/app/js/customUploader/index.html
Normal file
35
ИЭТР-тест/Develop/app/js/customUploader/index.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
|
||||
<script src="common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form class="DEF_form JS_validate JS_placeholder_emulate" enctype="multipart/form-data" action="" method="POST" novalidate="novalidate">
|
||||
<div class="DEF_form__item">
|
||||
<label class="input_label">Имя</label>
|
||||
<input type="text" value="" name="situation_name" data-rule-required="true" autocomplete="off" aria-required="true">
|
||||
<div class="item_anno"></div>
|
||||
</div>
|
||||
|
||||
<div class="DEF_form__item">
|
||||
<label class="input_label">E-Mail</label>
|
||||
<input type="email" value="" name="situation_email" data-rule-required="true" autocomplete="off" aria-required="true">
|
||||
</div>
|
||||
<div class="DEF_form__item">
|
||||
<label class="textarea_label">Сообщение</label>
|
||||
<textarea name="situation_message" data-rule-required="true" data-rule-minlength="2" aria-required="true"></textarea>
|
||||
</div>
|
||||
<div class="custom_upload_multiple">
|
||||
<div class="custom_upload_wrap">
|
||||
<input name="upl[]" type="file" value="">
|
||||
</div>
|
||||
</div>
|
||||
<div class="BUTTON_wrap">
|
||||
<button type="submit" class="BUTTON_01 BUTTON_01_type_01">Отправить</button>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
72
ИЭТР-тест/Develop/app/js/customUploader/style.css
Normal file
72
ИЭТР-тест/Develop/app/js/customUploader/style.css
Normal file
@@ -0,0 +1,72 @@
|
||||
form{
|
||||
font: 15px Arial, sans-serif;
|
||||
display: block;
|
||||
width: 400px;
|
||||
margin: 150px auto 0;
|
||||
}
|
||||
form input, form textarea{
|
||||
width: 100%;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
textarea{
|
||||
height: 120px;
|
||||
}
|
||||
.custom_upload_wrap {
|
||||
height: 85px;
|
||||
border: 1px dashed rgba(0, 0, 0, 0.2);
|
||||
background: white;
|
||||
border-radius: 5px;
|
||||
background-color: transparent;
|
||||
position: relative;
|
||||
display: block;
|
||||
text-align: center;
|
||||
-webkit-transition: all 0.3s ease;
|
||||
-moz-transition: all 0.3s ease;
|
||||
transition: all 0.3s ease;
|
||||
margin: 20px 0;
|
||||
}
|
||||
.custom_upload {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
}
|
||||
.custom_upload_button {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
-webkit-transition: all 0.3s ease;
|
||||
-moz-transition: all 0.3s ease;
|
||||
transition: all 0.3s ease;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
padding-top: 15px;
|
||||
}
|
||||
.custom_upload input {
|
||||
top: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
}
|
||||
.custom_upload_button.file_selected, .custom_upload_wrap:hover {
|
||||
background: rgba(206, 241, 199, 0.5);
|
||||
}
|
||||
.custom_upload_delete {
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 12px;
|
||||
margin: auto;
|
||||
width: 13px;
|
||||
height: 13px;
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
background: url(images/close.png) no-repeat;
|
||||
}
|
||||
Reference in New Issue
Block a user