Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Заходить через index.html #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Task 4: Layout</title>
<link rel="stylesheet" type="text/css" href="main.css">
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script type="text/javascript">
$(function (){
var $container = $('#container'),
variants = {};

$('.variant-container .variant-list').each(function () {
variants[this.id] = $(this);
})

$('.subtask-container').on('click', 'a', onMenuChosen(function (result) {
var $anchor;

for (var key in variants) {
if (key == result) {
variants[key].show();
$anchor = variants[key].find('a').first();
if ($anchor.length > 0) {
$anchor.trigger('click');
}
else {
$container.attr('src', result);
}
}
else {
variants[key].hide()
}
}
}));

$('.variant-container').on('click', 'a', onMenuChosen(function (result) {
$container.attr('src', result);
}))

$('.subtask-list a').first().trigger('click');
})

function onMenuChosen(callback) {
return function (e) {
e.preventDefault();

var $this = $(this),
$li = $this.parent(),
val = $this.attr('href').substring(1);

$li.siblings('.menu-item-current')
.removeClass('menu-item-current');
$li.addClass('menu-item-current');

if (callback)
callback(val);
};
}
</script>
</head>
<body>
<div id="header">
<div class="subtask-container">
<ul class="subtask-list menu-list">
<li class="subtask menu-item"><a href="#variant_list_1">Эй вы, трое</a></li>
<li class="subtask menu-item"><a href="#variant_list_2">Всегда в центре</a></li>
<li class="subtask menu-item"><a href="#variant_list_3">Подвал</a></li>
<li class="subtask menu-item"><a href="#variant_list_4">Двигайся, давай</a></li>
<li class="subtask menu-item"><a href="#">Тройняшки мы</a></li>
</ul>
</div>
<div class="variant-container">
<ul id="variant_list_1" class="variant-list menu-list">
<li class="variant menu-item"><a href="#task_1_01.html">table</a></li>
<li class="variant menu-item"><a href="#task_1_02.html">relative</a></li>
<li class="variant menu-item"><a href="#task_1_03.html">float</a></li>
</ul>
<ul id="variant_list_2" class="variant-list menu-list">
<li class="variant menu-item"><a href="#task_2_01.html">hor/fix width - margin:auto</a></li>
<li class="variant menu-item"><a href="#task_2_02.html">hor/fix width - position</a></li>
<li class="variant menu-item"><a href="#task_2_03.html">hor/flexible - position+float</a></li>
</ul>
<ul id="variant_list_3" class="variant-list menu-list">
<li class="variant menu-item"><a href="#task_3_01.html">Variant 1</a></li>
</ul>
<ul id="variant_list_4" class="variant-list menu-list">
<li class="variant menu-item"><a href="#task_4.html">main</a></li>
</ul>
</div>
</div>
<div id="x">
<iframe id="container" frameborder="0">
</iframe>
</div>
</body>
</html>
76 changes: 76 additions & 0 deletions main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
font: 15px Arial,Helvetica,sans-serif;
height: 100%;
}

#header {
position: absolute;
top: 0;
width: 100%;
background: #fff;
overflow: auto;
}
#x {
height: 100%;
padding-top: 68px;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}
#container {
height: 100%;
width: 100%;
border: 0;
margin: 0 0 -4px;
}

ul.menu-list {
padding: 0;
margin: 0;
list-style: none;
}
li.menu-item {
display: inline-block;
zoom: 1;
*display: inline;
}

.subtask-container,
.variant-container {
border-bottom: 1px solid rgb(209, 208, 207);
}
li.subtask,
li.variant {
border-bottom: 1px solid rgba(0, 0, 0, 0);
padding: 0 10px
}
li.subtask:hover,
li.variant:hover {
border-color: green;
}
li.subtask.menu-item-current,
li.variant.menu-item-current {
border-color: blue;
}
li.subtask a,
li.variant a {
text-decoration: none;
}

.subtask-container {
line-height: 38px;
overflow: hidden;
}

.variant-container {
line-height: 28px;
overflow: hidden;
}
ul.variant-list {
display: none;
}
50 changes: 50 additions & 0 deletions task_1_01.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Subtask 1</title>
<style type="text/css">
body {
padding: 0;
margin: 0;
}
html,
body,
table {
height: 100%;
}
table {
width: 100%;
border-collapse: collapse;
height: 100%;
}
td {
color: #3e8b9c;
font: 20px/100% 'Helvetica Neue', Helvetica, Arial, sans-serif;
vertical-align: middle;
text-align: center;
}
.left {
width: 25%;
background: #93aeb6;
}
.center {
width: 50%;
background: #aabfc0;
}
.right {
width: 25%;
background: #b5c7c5;
}
</style>
</head>
<body>
<table>
<tr>
<td class="left">25%</td>
<td class="center">50%</td>
<td class="right">25%</td>
</tr>
</table>
</body>
</html>
52 changes: 52 additions & 0 deletions task_1_02.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Subtask 2</title>
<style type="text/css">
body {
padding: 0;
margin: 0;
}
html,
body{
height: 100%;
}
.row {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
.col {
position: relative;
height: 100%;
top: 0px;
display: inline-block;
color: #3e8b9c;
font: 20px/100% 'Helvetica Neue', Helvetica, Arial, sans-serif;
text-align: center;
}
.col1 {
left: 0;
width: 25%;
background: #93aeb6;
}
.col2 {
left: 0;
width: 50%;
background: #aabfc0;
}
.col3 {
left: 0;
width: 25%;
background: #b5c7c5;
}
</style>
</head>
<body>
<div class="row">
<div class="col col1">25%</div><div class="col col2">50%</div><div class="col col3">25%</div>
</div>
</body>
</html>
51 changes: 51 additions & 0 deletions task_1_03.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Subtask 3</title>
<style type="text/css">
body {
padding: 0;
margin: 0;
}
html,
body{
height: 100%;
}
.row {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
.col {
height: 100%;
color: #3e8b9c;
font: 20px/100% 'Helvetica Neue', Helvetica, Arial, sans-serif;
text-align: center;
}
.col1 {
float: left;
width: 25%;
background: #93aeb6;
}
.col2 {
float: left;
width: 50%;
background: #aabfc0;
}
.col3 {
float: left;
width: 25%;
background: #b5c7c5;
}
</style>
</head>
<body>
<div class="row">
<div class="col col1">25%</div>
<div class="col col2">50%</div>
<div class="col col3">25%</div>
</div>
</body>
</html>
26 changes: 26 additions & 0 deletions task_2_01.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Subtask 1</title>
<style type="text/css">
body {
padding: 0;
margin: 0;
}
div {
border: 1px solid #da6b6b;
color: #3e8b9c;
width: 100px;
font: 20px/100% 'Helvetica Neue', Helvetica, Arial, sans-serif;
vertical-align: middle;
text-align: center;

margin: 20px auto 0;
}
</style>
</head>
<body>
<div>100px</div>
</body>
</html>
34 changes: 34 additions & 0 deletions task_2_02.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Subtask 2</title>
<style type="text/css">
html,
body{
height: 100%;
}
body {
padding: 0;
margin: 0;
}
div {
border: 1px solid #da6b6b;
color: #3e8b9c;
font: 20px/100% 'Helvetica Neue', Helvetica, Arial, sans-serif;
vertical-align: middle;
text-align: center;

width: 100px;

position: relative;
top: 20px;
left: 50%;
margin: 0 -50px;
}
</style>
</head>
<body>
<div>100px</div>
</body>
</html>
Loading