Ads 468x60px

Labels

Friday, March 21, 2014

How to Creating Content Tabs with Pure CSS


Creating Content Tabs with Pure CSS it's very simple Try to this code
HTML Code here
<ul class="tabs">
<li> <input type="radio" checked name="tabs" id="tab1">
<label for="tab1"> tab 1</label>
<div id="tab-content1" class="tab-content"> Tab Content 1 </div> </li>

<li> <input type="radio" name="tabs" id="tab2"> <label for="tab2">
tab 2</label>
<div id="tab-content2" class="tab-content">
Tab Content 2 </div> </li>

<li>
<input type="radio" name="tabs" id="tab3">
<label for="tab3"> tab 3</label>
<div id="tab-content3" class="tab-content">
Tab Content 3 </div> </li>
</ul>
Css Code here

body, html {
height: 100%;
margin: 0;
-webkit-font-smoothing: antialiased;
font-weight: 100;
background:#90f286 ;
text-align: center;
font-family: arial;
}

.tabs input[type=radio] {
display:none;
}

.tabs {
width: 600px;
list-style: none;
position: relative;
padding: 0;
margin: 75px auto;
}

.tabs li{
float: left;
}

.tabs label {
display: block;
padding: 10px 20px;
border-radius: 2px 2px 0 0;
color: #000;
font-size: 24px;
font-weight: normal;
background: rgba(0,0,0,0.2);
cursor: pointer;
position: relative;
margin-top:3px;
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}

.tabs label:hover {
background: #0a71a5;
color:#fff;
top: 0;
}

[id^=tab]:checked + label {
background: #0a71a5;
color: white;
top: 0;
}

[id^=tab]:checked ~ [id^=tab-content] {
display: block;
}

.tab-content{
z-index: 2;
display: none;
text-align: left;
font-size: 20px;
padding-top: 10px;
background: #0a71a5;
padding: 15px;
color: white;
position: absolute;
top: 51px;
left: 0;
right:0;
box-sizing: border-box;
-webkit-animation-duration: 0.5s;
-o-animation-duration: 0.5s;
-moz-animation-duration: 0.5s;
animation-duration: 0.5s;
}

Demo Jsfiddle

Section have a fixed position when it hits the top of the screen

How to do this it's very simple here example see below .
Jquery Code
var oritop = -100;
$(window).scroll(function() {
var scrollt = $(this).scrollTop();
var elm = $(".scrollTopWindow");
if(oritop < 0) {
oritop= elm.offset().top;
}
if(scrollt >= oritop) {
elm.css({"position": "fixed", "top": 0, "left": 0});
}
else {
elm.css("position", "static");
}
});
Css here code as Sample
body{height:2000px}
.scrollTopWindow {
background-color: red;
width: 150px;
height: 100px;
color: white;
padding:20px;
}
HTML Code here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
Some Content here
<div class = "scrollTopWindow"> Scroll top window and fix me ! </div>

Demo Jsfiddle

Wednesday, March 5, 2014

How to create a tooltips with jQuery

simple idea to create a tooltips
HTML
<input type="text" title="Here put your toottips text " />
CSS
.autoSugest{background:#fffdef;border:1px solid #cac6ad;
-webkit-border-radius:4px;
-moz-border-radius:4px;
border-radius:4px;color:#7f7943;
display:none;
font-size:12px;
padding:7px 15px;
position:absolute;
min-width:100px;
-o-box-sizing:border-box;
-ms-box-sizing:border-box;
-webkit-box-sizing:border-box;
-moz-box-sizing:border-box;
box-sizing:border-box;}
.autoSugest:after{
content:url("../../images/tootl-tip-arrow.png"); height:8px;
width:11px;
position:absolute;
top:-13px;
left:38px}
Jquery
$.fn.autoSuggest = function(){ return this.each(function(index, elm){
if(!$(elm).is('[data-title]')){
$(elm).attr('data-title', $(elm).attr('title')).attr('title', '');
};

$(elm).on('focus', function(){
var element = $(this),
posTop = element.offset().top + element.outerHeight() + 10,
posLeft = element.offset().left,
toolTipWidth = element.outerWidth() > 90 ? element.outerWidth() : 250,
titleText = element.attr('data-title');
if(titleText && titleText != ''){
$('<div />', {class: 'autoSugest', text : titleText, css : {left: posLeft, top: posTop, maxWidth: toolTipWidth}}).appendTo('body').fadeIn();
}else{
return false;
}
});
$(elm).on('blur', function(){
$('.autoSugest').fadeOut(function(){
$(this).remove();
});
});
}); };
$(document).ready(function(){
    $('input[title]').autoSuggest(); });