Responsive Design
by Arlina Fitriyani
HTML
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<header class='opened' id='header'>
<h1 class='logo' data-title='AD'></h1>
<div class='menu'>
<span class='selected icon-dar'>New Template</span>
<ul class='drop'>
<li class='link checked' data-url='http://afusions.blogspot.com'>MC3 Mag Style</li>
<li class='link' data-url='http://minima9.blogspot.com' rel='nofollow'>MC2</li>
<li class='link' data-url='http://minima8.blogspot.com' rel='nofollow'>Minima</li>
<li class='link' data-url='http://lycoris9.blogspot.com' rel='nofollow'>Lycoris</li>
<li class='link' data-url='http://lunafy.blogspot.com' rel='nofollow'>Lycoris Dark</li>
</ul>
</div>
<div class='devices'>
<button class='device desk active'></button>
<button class='device tablet'></button>
<button class='device tablet-land'></button>
<button class='device phone'></button>
<button class='device phone-land'></button>
</div>
<div class='options'>
<button class='close entypo-cancel'></button>
</div>
</header>
<main class='opened' id='frame'>
<iframe height='100%' src='http://afusions.blogspot.com' rel='nofollow' width='100%'></iframe>
</main>
CSS
@import url(http://meyerweb.com/eric/tools/css/reset/reset.css);
@import url(http://fonts.googleapis.com/css?family=Fjalla+One);
@import url(http://weloveiconfonts.com/api/?family=entypo);
/* entypo */
[class*="entypo-"]:before {
font-family: 'entypo', sans-serif;
}
body {
background: #444;
font-family: sans-serif;
font-size: 10pt;
font-smoothing: antialiased;
}
#header {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 50px;
background: #222;
z-index: 1;
transition: top .15s ease;
}
#header.closed {
top: -50px;
}
#header .logo {
cursor: pointer;
position: relative;
float: left;
width: 50px;
height: 50px;
background: rgba(255, 255, 255, 0.05);
overflow: hidden;
font-family: 'Fjalla One', sans-serif;
font-size: 20pt;
color: #FFF;
font-weight: bold;
line-height: 55px;
text-align: center;
}
#header .logo:before {
content: attr(data-title);
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
transform: rotate(-45deg);
}
#header .menu {
position: relative;
float: left;
width: 150px;
height: 30px;
margin: 10px 0 0 10px;
color: #FFF;
}
#header .menu .selected {
cursor: pointer;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
padding: 0 10px;
border-radius: 3px;
background: rgba(255, 255, 255, 0.05);
font-weight: bold;
line-height: 30px;
}
#header .menu .selected:before {
float: right;
line-height: 33px;
}
#header .menu .drop {
position: absolute;
top: 40px;
left: 0;
right: 0;
max-height: 210px;
background: #333;
display: none;
overflow: auto;
font-weight: bold;
}
#header .menu .drop::-webkit-scrollbar {
width: 3px;
background: rgba(0, 0, 0, 0.15);
}
#header .menu .drop::-webkit-scrollbar-thumb {
background: #318DBD;
}
#header .menu .drop .link {
cursor: pointer;
height:...
JavaScript
$('.menu .selected').on('click',function(){
$(this).next('.drop').toggle();
});
$('.menu .drop .link').on('click',function(){
var $active = $('.menu .checked'),
input = $(this).text(),
url = $(this).data('url'),
$selected = $('.menu .selected');
$active.removeClass('checked');
$(this).addClass('checked');
$selected.text(input);
$('#frame iframe').attr('src',url);
});
$('.close').on('click',function(){
if ( $('#header').hasClass('opened') ) {
$('#header,#frame').removeClass('opened').addClass('closed')
.find('.menu .drop').hide();
} else if ( $('#header').hasClass('closed') ) {
$('#header,#frame').removeClass('closed').addClass('opened');
}
if ( $(this).hasClass('entypo-down-open') ) {
$(this).removeClass('entypo-cancel').addClass('entypo-cancel');
} else if ( $(this).hasClass('entypo-down-open') ) {
$(this).removeClass('entypo-cancel').addClass('entypo-down-open');
}
});
$('.devices .device').on('click',function(){
var $active = $('.devices .active'),
$frame = $('#frame iframe');
if ( $(this).hasClass('desk') ) {
$active.removeClass('active');
$(this).addClass('active');
$frame.css({ width: '100%' });
} else if ( $(this).hasClass('tablet') ) {
$active.removeClass('active');
$(this).addClass('active');
$frame.css({ width: '788px' });
} else if ( $(this).hasClass('tablet-land') ) {
$active.removeClass('active');
$(this).addClass('active');
$frame.css({ width: '1040px' });
} else if ( $(this).hasClass('phone') ) {
$active.removeClass('active');
$(this).addClass('active');
$frame.css({ width: '340px' });
} else if ( $(this).hasClass('phone-land') ) {
$active.removeClass('active');
$(this).addClass('active');
$frame.css({ width: '500px' });
}
});