Показать сообщение отдельно
  #2 (permalink)  
Старый 26.03.2020, 07:43
Аватар для ksa
ksa ksa вне форума
CacheVar
Отправить личное сообщение для ksa Посмотреть профиль Найти все сообщения от ksa
 
Регистрация: 19.08.2010
Сообщений: 14,121

Сообщение от Lefseq
Помогите добавить ссылку закрывания модального окна, которая будет располагаться внутри самого окна.
Это не модальное окно...
Как вариант...
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251' />
<!--
<script src='https://code.jquery.com/jquery-latest.js'></script>
-->
<style type='text/css'>
#wrap9{
	display: none;
	opacity: 0.5;
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	background-color: rgba(255, 255, 255, 1);
	z-index: 100;
	overflow: auto;
}
#window9{
	width: 500px;
	height: 100px;
	margin: auto;
	display: none;
	background: #fff;
	border: 1px solid #365E97;
	z-index: 200;
	position: fixed;
	left: 0;
	right: 0;
	top: 0;
	bottom: 0;
	padding: 15px 30px 30px 30px;
	vertical-align:middle;
	-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);
	box-shadow:0 5px 15px rgba(0,0,0,.5);
}
#off {
	position: absolute;
	top: 2px;
	right: 5px;
	cursor: pointer;
}
</style>
<script type='text/javascript'>
function show(state) {
	var o=document.getElementById('window9');
	o.style.display = state;
	document.getElementById('wrap9').style.display = state;
	if (!o.querySelector('#off')) {
		var e=document.createElement('a');
		e.id='off';
		e.innerHTML='x';
		e.onclick=function(){
			show('none');
		};
		o.appendChild(e);
	};
};
</script>
</head>
<body>
<button onclick="show('block')">Открыть окно</button>
<div onclick="show('none')" id="wrap9"></div>
<div id="window9">  
Содержимое окна
</div>
</body>
</html>
Ответить с цитированием