-
Notifications
You must be signed in to change notification settings - Fork 0
/
div.html
118 lines (113 loc) · 5.35 KB
/
div.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Descrição Responsiva E-Commerce - Crie uma descrição HTML responsiva que se adapta ao dispositivo usado">
<meta name="author" content="Douglas Carlos">
<title>Descrição Responsiva E-Commerce | <div></title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<meta property="og:description" content="Descrição Responsiva E-Commerce - <picture>"/>
<!-- Cloudflare Web Analytics --><script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "4b850094330e4597a536cdeb398e0768"}'></script><!-- End Cloudflare Web Analytics -->
</head>
<body>
<div class="mx-auto text-center col-md-8 order-md-1">
<br>
<h2><a href="index.html">←</a> Descrição Responsiva E-Commerce</h2>
<h5>Crie uma descrição HTML responsiva que se adapta ao dispositivo usado</h5>
<br>
<h4>Usando o elemento <code><div></code>.</h4>
<br>
<div class="card">
<div class="card-body">
<form name="yourform">
<div class="form-row">
<div class="form-group col-md-8">
<label for="inputUsuario">Endereço da imagem Mobile<br></label>
<input type="text" class="form-control" id="endereco_img_mobile" value="https://descricao-responsiva-e-commerce.pages.dev/img/frog_mobi_01.jpg">
</div>
<div class="form-group col-md-4">
<label for="inputSenha">Tamanho máximo da tela Mobile</label>
<input type="text" class="form-control" id="tamanho_mobile" value="800" maxlength="4">
</div>
<div class="form-group col-md-8">
<label for="inputUsuario">Endereço da imagem Desktop</label>
<input type="text" class="form-control" id="endereco_img_desktop" value="https://descricao-responsiva-e-commerce.pages.dev/img/frog_desk_01.jpg">
</div>
<div class="form-group col-md-4">
<label for="inputSenha">Tamanho mínimo da tela Desktop</label>
<input type="text" class="form-control" id="tamanho_desktop" value="801" maxlength="4">
</div>
</div>
<br><br>
<div class="form-group">
Código<br>
</div>
<div class="form-group">
<textarea class="form-control" id="text1" data-current="true" name="text1" rows="10"><!-- Criado em https://descricao-responsiva-e-commerce.pages.dev/ -->
</textarea>
</div>
<input type="button" class="btn btn-primary" value="Adicionar" onClick="onClick()"/>
<div class="form-group">
<br><input type="button" class="btn btn-success" value="Visualização" onClick="recarregarVisualizacao()"/>
</div>
</form>
</div>
</div>
<div class="form-group">
<br><a id="img"></a>
</div>
<script type="text/javascript">
var clicks = 0;
function onClick() {
clicks += 1;
const input_endereco_img_tela_mobile = document.getElementById('endereco_img_mobile').value;
const input_endereco_img_tela_desktop = document.getElementById('endereco_img_desktop').value;
const input_tamanho_tela_mobile = document.getElementById('tamanho_mobile').value;
const input_tamanho_tela_desktop = document.getElementById('tamanho_desktop').value;
valor1 = '<div id=\"scoped-content\" style=\"text-align:center;\">\n\
<style type=\"text/css\" scoped>\n\
';
valor2 = ' @media only screen and (min-width: ' + input_tamanho_tela_desktop + 'px) {\n\
';
valor3 = ' img.descricao_html' + clicks + ' {\n\
';
valor4 = ' content:url(' + input_endereco_img_tela_desktop + ');\n\
';
valor5 = ' }\n\
}\n\
';
valor6 = ' @media only screen and (max-width: ' + input_tamanho_tela_mobile + 'px) {\n\
';
valor7 = ' img.descricao_html' + clicks + ' {\n\
';
valor8 = ' content:url(' + input_endereco_img_tela_mobile + ');\n\
';
valor9 = ' }\n\
}\n\
</style>\n\
';
valor10 = ' <img class=\"descricao_html' + clicks + ' img-fluid\" src=\"\" style=\"margin-top:calc(-5px);display:block;margin:0 auto;\">\n\
</div>\n\
';
document.forms['yourform']['text1'].value += valor1 + valor2 + valor3 + valor4 + valor5 + valor6 + valor7 + valor8 + valor9 + valor10;
document.getElementById("img").innerHTML += valor1 + valor2 + valor3 + valor4 + valor5 + valor6 + valor7 + valor8 + valor9 + valor10;
};
function recarregarVisualizacao() {
const conteudo_textarea = document.forms['yourform']['text1'].value;
document.getElementById("img").innerHTML = conteudo_textarea;
}
</script>
</div>
<footer class="pt-3 my-md-2">
<div class="row">
<div class="col-12 col-md">
<small class="d-block mb-3 text-muted text-center">© 2024<br><a href="https://github.com/douglascarlos-dev/descricao-responsiva-e-commerce" target="_blank"><img src="./img/logo.svg" alt="HTML tutorial" style="height:35px;"></a></small>
</div>
</div>
</footer>
</div>
<script src="js/jquery-3.2.1.slim.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>