Created
April 3, 2017 08:25
-
-
Save shorsa/b45932cbcc8b3049585ea8ba2e2cb5cc to your computer and use it in GitHub Desktop.
null created by shorsa - https://repl.it/DyeE/76
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body{ | |
font-family:verdana; | |
color:#444; | |
} | |
#option1,#option2,#option3{ | |
background-size: cover; | |
} | |
button{ | |
/*text-decoration: none;*/ | |
font-size: 20px; | |
width: 150px; | |
height: 150px; | |
margin-right: 20px; | |
color: #fff; | |
background: #3C8FB7; | |
/*padding: 50px;*/ | |
/*border: 0;*/ | |
cursor: pointer; | |
font-family: 'Oswald', sans-serif; | |
} | |
#sub{ | |
width: 50%; | |
height: 80px; | |
margin-top: 50px; | |
} | |
#option1 { | |
background-image: url("https://surviocdn.com/s1/user-img/options/dad/dade5d524eb6841a49722093b04c2aebe3bf67f0.png"); | |
margin-bottom: -20px; | |
} | |
#option2 { | |
background-image: url("https://surviocdn.com/s1/user-img/options/cf4/cf4bb81c176a60101249b1f1ce909f217464d711.png"); | |
} | |
#option3 { | |
background-image: url("https://surviocdn.com/s1/user-img/options/c35/c35c3414e1c582e2d2aad8dc92056c0cf5cb4ac3.png"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>repl.it</title> | |
<link href="index.css" rel="stylesheet" type="text/css" /> | |
<script src="index.js"></script> | |
<script | |
src="https://code.jquery.com/jquery-3.1.1.min.js" | |
integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" | |
crossorigin="anonymous"></script> | |
<script src="index.js"></script> | |
<link href="https://fonts.googleapis.com/css?family=Oswald:700" rel="stylesheet"> | |
</head> | |
<body> | |
<div id='container'> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
(function($) { | |
$.fn.myPlugin = function(tests){ | |
var len = tests.length; | |
var res = {}; | |
var i =0; | |
function a(i){ | |
if (i == 0 ){ | |
$("#container").append("<button>НАЧАТЬ ОПРОС</button>").one("click", function (){ | |
for (var i = 0 ; i < len; i++ ){ | |
var ques0 = tests[0+i].question; | |
var answ0 = tests[0+i].answers[0]; | |
var answ1 = tests[0+i].answers[1]; | |
var answ2 = tests[0+i].answers[2]; | |
function pushInRes(one,b){ | |
res[one] = b; | |
} | |
var div = $("#container"); | |
var p = $("<br><p>").attr("id","answers").html(ques0); | |
var answers1 = $("<button>").attr("id", "option1","value","answ0","name","my").text(answ0).one('click', function(){res[ques0]=answ0}); | |
var answers2 = $("<button>").attr("id", "option2","value","answ1","name","my").text(answ1).one('click', function(){res[ques0]=answ1}); | |
var answers3 = $("<button>").attr("id", "option3","value","answ2","name","my").text(answ2).one('click', function(){res[ques]=answ2} | |
); | |
var sub = $("<br><button>").attr("id", "sub","value","sub","name","my").text("Всё").one('click',function(){ | |
resss(); | |
}); | |
$(div).append(p, answers1,answers2,answers3); | |
} | |
$(div).append(sub); | |
}); | |
} | |
} | |
function resss(){ | |
for(key in res){ | |
console.log(key+'' + res[key]); | |
} | |
} | |
a(i); | |
return this; | |
} | |
})(jQuery); | |
var dan = [{question:"По какой причине Вы вошли в наш интернет-магазин?", | |
answers :["Серфинг по сети","Поиск определенного товара","Сравнение цен"]}, | |
{question:"Насколько трудной была ориентация в нашем интернет-магазине?", | |
answers :["Нетрудная","Ни то, ни другое","Трудная"]}, | |
{question : "Сложно ли было найти конкретный товар в нашем интернет-магазине?", | |
answers :["Да","Ни то, ни другое","Нет"]}, | |
]; | |
$('#container').myPlugin(dan); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment