Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>MATCH</title>
- <meta charset="utf-8">
- <style type="text/css">
- body {
- margin: 0px
- }
- .container {
- width: 100vw;
- height: 100vh;
- background: #fff;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- }
- .container h1{
- position: absolute;
- top: 45px;
- color: #000;
- }
- .container .perg{
- position: absolute;
- top: 110px;
- color: brown;
- font-size: 20px;
- font-weight: bold;
- }
- .box1 {
- width: 300px;
- height: 300px;
- background: #fff;
- margin-right: 15px;
- cursor: pointer;
- }
- .box1 img{
- border-radius: 150px;
- }
- .box2 {
- width: 300px;
- height: 300px;
- background: #fff;
- cursor: pointer;
- }
- .box2 img{
- border-radius: 150px;
- }
- .jeh-vence{
- width: 305px;
- position: absolute;
- bottom: 25px;
- left: 375px;
- text-align: center;
- color: #00487C;
- font-size: 40px;
- display: none;
- }
- .edu-vence{
- width: 306px;
- position: absolute;
- bottom: 25px;
- left: 686px;
- text-align: center;
- color: #00487C;
- font-size: 40px;
- display: none;
- }
- .botao{
- position: absolute;
- bottom: 20px;
- }
- .botao input{
- width: 300px;
- height: 30px;
- border-radius: 3px;
- background-color: #548B54;
- border-style: none;
- color: #fff;
- font-weight: bold;
- font-size: 20px;
- text-transform: uppercase;
- cursor: pointer;
- }
- </style>
- </head>
- <body>
- <form action="{{url_for('registraVoto')}}" method="POST">
- <div class="container">
- <h1>THE FACE MATCH</h1>
- <p class="perg">Qual a pessoa que mais te interessou? Vote!</p>
- <div class="box1" id="boxJeh" >
- <img src="../static/img/jeh.png" class="img-jeh" name="jeh" width="300" />
- </div>
- <div class="box2" id="boxEdu">
- <img src="../static/img/edu.png" class="img-edu" name="edu" width="300" />
- </div>
- <div class="jeh-vence" id="Jeh">
- <p>Gostou mais de Jéssica?</p>
- </div>
- <div class="edu-vence" id="Edu">
- <p>Gostou mais de Eduardo?</p>
- </div>
- <div class="botao">
- {{form.botaopy}}
- </div>
- </div>
- </form>
- <script src="https://code.jquery.com/jquery-3.4.1.min.js"
- integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
- crossorigin="anonymous">
- </script>
- <script>
- $(document).ready(function(){
- let eduClicked = $('#Edu');
- let jehClicked = $('#Jeh');
- $("#boxEdu").click(function(){
- $("#boxEdu").css("border-style", "ridge");
- $("#boxEdu").css("border-radius", "155px");
- $("#boxEdu").css("border-color", "#00EB00");
- $("#boxEdu").css("box-shadow", "8px 7px 10px #548B54");
- eduClicked.show("fast", function() {
- // Animation complete.
- });
- jehClicked.hide();
- $("#boxJeh").css("border-style", "");
- $("#boxJeh").css("border-radius", "");
- $("#boxJeh").css("border-color", "");
- $("#boxJeh").css("box-shadow", "");
- });
- $("#boxJeh").click(function(){
- $("#boxJeh").css("border-style", "ridge");
- $("#boxJeh").css("border-radius", "155px");
- $("#boxJeh").css("border-color", "#00EB00");
- $("#boxJeh").css("box-shadow", "8px 7px 10px #548B54");
- jehClicked.show("fast", function(){
- // Animation complete.
- });
- eduClicked.hide();
- $("#boxEdu").css("border-style", "");
- $("#boxEdu").css("border-radius", "");
- $("#boxEdu").css("border-color", "");
- $("#boxEdu").css("box-shadow", "");
- });
- pegueiEdu = $(".img-edu").attr("name");
- pegueiJeh = $(".img-jeh").attr("name");
- });
- let eventEdu = $('#boxEdu');
- let eventJeh = $('#boxJeh');
- let obj = {pegueiEdu:"Edu",pegueiJeh:"Jeh"};
- var json = JSON.stringify(obj);
- $(eventEdu).on("click", function(){
- pegueiEdu = $(".img-edu").attr("name");
- console.log('Clicou em '+pegueiEdu);
- $.ajax({
- url: '/votar',
- type: 'POST',
- data: json, // converts js value to JSON string
- success: function(response){
- $('.img-edu').text(response);
- }
- });
- $.ajax({
- url: '/votar',
- type: 'POST',
- data: {'getEdu':pegueiEdu},
- });
- });
- $(eventJeh).on("click", function(){
- pegueiJeh = $(".img-jeh").attr("name");
- console.log('Clicou em '+pegueiJeh);
- $.ajax({
- url: '/votar',
- type: 'POST',
- data: json, // converts js value to JSON string
- success: function(response){
- $('.img-jeh').text(response);
- }
- });
- $.ajax({
- url: '/votar',
- type: 'POST',
- data: {'getJeh':pegueiJeh},
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement