jQuery Cycle Banner Slider

Here you go, just a quick tip for anyone out there that needs a quick slider. Just download the following Lastest JQuery and Lastest Cycle


body{background:#666;}

#wrapper{		
	margin:0 auto;
	display:block;
	width:600px;
	padding:0;
		
	}
.slide-cover{
	position:relative;
	width:500px;
	}
	#slider{
	margin:150px 0px;
	padding:0;
	list-style:none;
	width:500px;
	height:auto;
	
	  -moz-box-shadow:    0px 0px 20px 0px #000;
	  -webkit-box-shadow: 0px 0px 20px 0px #000;
	  box-shadow:         0px 0px 20px 0px #000;
	}
	#slider li{
	margin:0;
	padding:0;
	list-style:none;
	width:500px;
	height:auto;
	}
	/* Styles Nav */
	#nav-slider{
	position:absolute;
	top:60px;
	padding:0;		
	width:500px;
	z-index:9999;
	}
	#nav-slider li{	
	position:absolute;
	list-style:none;
	width:50px;
	height:50px;
	background: url(arrow.png) no-repeat;
	}
	#nav-slider li.next{		
	right:0;
	background-position:top right;
	}
	#nav-slider li.next:hover {background-position:right bottom;}
	#nav-slider li.prev {
	left:0;
	background-position:top left;
	}
	#nav-slider li.prev:hover {background-position:left bottom;}

$(document).ready(function() {
    $('#slider').cycle({
        fx: 'scrollHorz',
        timeout:    4000,
        speed:      800,
        next: '#nav-slider .next',
        prev: '#nav-slider .prev',
        height: 200,
        pause: 1
    });
});

<div id="wrapper">

<section class="slide-cover">
   <ul id="slider">
      <li><img src="1.jpg"/></li>
      <li><img src="2.jpg"/></li>
      <li><img src="3.jpg"/></li>
   </ul>
   <ul id="nav-slider">
      <li class="next"></li>
      <li class="prev"></li>
   </ul>
</section>

</div>

jQuery Sticky Menu


	<!DOCTYPE html>
	<html>
	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
	<script type="text/javascript" src="jquery.easing.1.2.js" type="text/javascript"></script>
	

	<style>
	html,body{margin:0;padding:0;}
	#wrapper{
	  width:1000px;
	  margin:0 auto;
	  padding:0;
	}
	.content{
	  width:1000px;
	  margin:0;
	  min-height:800px;
	  height:auto;
	  padding:80px 0 0 0;
	}
	#sticky-menu {
	  background:#f2f2f2;
          background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #ffffff), 
          color-stop(40%, #f2f2f2), color-stop(100%, #f2f2f2));   
          background: -moz-linear-gradient(top, #ffffff, #f2f2f2, #f2f2f2);   
         line-height: 120px;   
         text-align: center;   
         margin: 0 auto;  
         padding: 0;   
         z-index:1; } 
#sticky-menu .sub-nav {   padding: 0;   width:1000px;   margin: 0 auto;   height: 80px; } #sticky-menu ul {   float:right;   padding: 0;   width:auto;   margin: 0 auto;   height: 80px; } #sticky-menu ul li {   list-style-type: none;   display: inline;   float:left;   border-left:solid 1px #b2b2b2;   height: 80px; } #sticky-menu ul li.last-child {   border-right:solid 1px #b2b2b2; } 
#sticky-menu ul li {   display:block;   height: 80px;   background: url(images/icon-sticky-on.png) no-repeat center top;   -webkit-transition-property: color, background;   -webkit-transition-duration: 0.5s, 0.5s; } 
#sticky-menu ul li:hover , #sticky-menu ul li:active , #sticky-menu ul li.selected{   background:#f2f2f2;   background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f2f2f2), color-stop(40%, #ffffff), color-stop(100%, #ffffff));   background: -moz-linear-gradient(top, #f2f2f2, #ffffff, #fffffff);   background: url(images/icon-sticky.png) no-repeat center top; } #sticky-menu ul li a{   display:block;   text-align:center;   text-decoration: none;   text-shadow: 1px 1px 1px #fff;   padding:0 30px 0 30px;   font-size:16px;   height: 80px;   width:auto;   font-size:16px; } .default {   width: 100%;   height: 80px;   border-bottom: solid 1px #b2b2b2; } .fixed {   position: fixed;   top: -5px;   left: 0;   z-index:1;   width: 100%;   border-bottom: solid 1px #b2b2b2;   box-shadow: 0 0 5px #222;   -webkit-box-shadow: 0 0 5px #222;   -moz-box-shadow: 0 0 5px #222; } </style></ul>

	 <div id="sticky-menu" class="default">
	  <nav class="sub-nav">
	  <ul>
	    <li><a href="#first">First</a></li>
	    <li><a href="#second">Second</a></li>
	    <li><a href="#third">Third</a></li>
	    <li><a href="#forth">Forth</a></li>
	    <li class="last-child"><a href="#top">top</a></li>
	  </ul>
	  </nav>
	 </div>
	 <div id="wrapper">
	  <section id="first" class="content"><h1>First</h1></section>
	  <section id="second" class="content"><h1>Second</h1></section>
	  <section id="third" class="content"><h1>Third</h1></section>
	  <section id="forth" class="content"><h1>Forth</h1></section>
	 </div>
	

	<script>
//Go Sticky

$(function() {
	var sticky_navigation_offset_top = $('#sticky-menu').offset().top;	
	var sticky_navigation = function(){
		var scroll_top = $(window).scrollTop(); 
		
		if (scroll_top > sticky_navigation_offset_top) { 
			$('#sticky-menu').css({ 'position': 'fixed', 'top':0, 'left':0 });
		} else {
			$('#sticky-menu').css({ 'position': 'relative' }); 
		}   
	};	
	sticky_navigation();
	$(window).scroll(function() {
		 sticky_navigation();
	});	
});

//scrollNav

(function($){
$.scrollNav = function(el, options){

	var base = this;
	base.$el = $(el);

	base.$el.data("scrollNav", base);

	base.win = window;
	base.$win = $(base.win);
	base.$doc = $(document);

	var scrollElement = 'html, body';
	$('html, body').each(function(){
		var initScrollTop = $(this).attr('scrollTop');
		$(this).attr('scrollTop', initScrollTop + 1);
		if ($(this).attr('scrollTop') === initScrollTop + 1) {
			scrollElement = this.nodeName.toLowerCase();
			$(this).attr('scrollTop', initScrollTop);
			return false;
		}
	});
	base.$body = $(scrollElement);

	base.init = function(){
		base.options = $.extend({},$.scrollNav.defaultOptions, options);
		base.content = $('.' + base.options.contentClass);
		base.leftMargin = parseInt( base.content.css('margin-left'), 10);
		base.rightMargin = parseInt( base.content.css('margin-right'), 10);

		if (!$.isFunction($.easing[base.options.easing[0]])) { base.options.easing = ['swing', 'swing']; }

		base.$body.bind('scroll mousedown DOMMouseScroll mousewheel keyup', function(e){
			if ( e.which > 0 || e.type === 'mousedown' || e.type === 'mousewheel' ){
				base.$body.stop();
			}
		});

		var links = base.options.selectedAppliedTo + (base.options.selectedAppliedTo === base.options.link ? '' : ' ' + base.options.link);
		base.$el.find(links)

			.add( $('.' + base.options.contentLinks) )
			.click(function(){

				var att = (this.tagName === "A") ? 'href' : base.options.targetAttr;
				base.animate($(this).attr(att));
				return false;
			});
		base.$win
			.scroll(function(){ base.findLocation(); })
			.resize(function(){ base.findLocation(); });
	};

	base.animate = function(sel){
		if (sel !== '#' && $(sel).length) { 
			var $sel = $(sel).eq(0).closest('.' + base.options.contentClass);
			base.$body.stop().animate({
				scrollLeft : Math.min( $sel.offset().left, base.$doc.width() - base.$win.width() ) - base.leftMargin,
				scrollTop  : Math.min( $sel.offset().top, base.$doc.height() - base.$win.height() )
			},{
				queue         : false,
				duration      : base.options.animationTime,
				specialEasing : {
					scrollLeft  : base.options.easing[0] || 'swing',
					scrollTop   : base.options.easing[1] || base.options.easing[0] || 'swing'
				},
				complete      : function(){
					if (base.options.useHash) { base.win.location.hash = $sel[0].id; }
				}
			});
		}
	};
	base.findLocation = function(){
		var tar, locLeft, locTop, sel, elBottom, elHeight, elWidth, elRight,
		winWidth = base.$win.width(),
		winLeft = base.$win.scrollLeft(),
		winTop = base.$win.scrollTop(),
		winRight = winLeft + winWidth,
		winBottom = winTop + base.$win.height(),
		docHeight = base.$doc.height(),
		el = base.$el.find(base.options.selectedAppliedTo).removeClass(base.options.inViewClass);
		if (base.options.fitContent) {
			base.content.width( winWidth - base.leftMargin - base.rightMargin );
		}
		base.$el.find(base.options.link).each(function(i){
			sel = $(this).attr(base.options.targetAttr);
			tar = (sel === "#" || sel.length <= 1) ? '' : $(sel);
			if (tar.length) {
				locTop = Math.ceil(tar.offset().top);
				locLeft = Math.ceil(tar.offset().left);
				elHeight = tar.outerHeight();
				elBottom = locTop + elHeight + base.options.bottomMargin;
				elWidth = tar.outerWidth();
				elRight = locLeft + elWidth;
				if ( locTop < winBottom && ( locTop + elHeight - base.options.bottomMargin > winTop || elBottom > winBottom ) &&
				locLeft < winRight && ( locLeft + elWidth - base.options.bottomMargin > winLeft || elRight > winRight ) ) {
					el.eq(i).addClass(base.options.inViewClass);
				}
			}
		});
		sel = ( winBottom + base.options.bottomMargin >= docHeight ) ? ':last' : ':first';
		el.removeClass(base.options.selectedClass);
		el.filter('.' + base.options.inViewClass + sel).addClass(base.options.selectedClass);
	};
	base.init();

	if (base.options.useHash && base.win.location.hash) {
		setTimeout(function(){
			base.animate(base.win.location.hash);
		}, base.options.animationTime/2);
	}
	base.findLocation();
};

$.scrollNav.defaultOptions = {
	link              : 'a',        
	targetAttr        : 'href',      
	selectedAppliedTo : 'li',        
	contentClass      : 'content',   
	contentLinks      : 'scrollNav', 
	useHash           : true,        
	inViewClass       : 'inView',    
	selectedClass     : 'selected',  
	bottomMargin      : 100,         
	fitContent        : false,      
	animationTime     : 1200,                
	easing            : [ 'swing', 'swing' ] 
};

$.fn.scrollNav = function(options){
	return this.each(function(){
		var nav = $(this).data('scrollNav');
		if (typeof options === "string" && /^(#|\.)/.test(options)) {
			nav.animate(options);
		}
		if (nav) { return; }
		(new $.scrollNav(this, options));
	});
};
$.fn.getvisualNav = function(){
	return this.data("scrollNav");
};

})(jQuery);
	</script>
	

	<script>
		$(document).ready(function(){
		 $('#sticky-menu').scrollNav();
		});
	</script>
	

10 Things you need to know about HTML5 What I Did!

The old way, who would want to remember that?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

New way So much cleaner

<!DOCTYPE html>

Did you that it is unnecessary for HTML5, but it is used for current and older browsers that require specific doctype. It’s because browsers do not understand doctype, it will render the markup to standard mode. So feel free to use this without any worries

2. The Figure Element

The old way

<img src="#url to image" alt="about"/>
<p>here some texts7lt;/p>

The new way

<figure>
<img src="#url to images" alt="about"/>
<figcaption>
<p>here some text too!</p>
</figcaption>
</figure>

There unfortunately isn’t any easy or semantic way to associate the caption, wrapped in a paragraph tag, with the image element itself. HTML5 rectifies this, with the introduction of the <figure> element. When combined with the <figcaption> element, we can now semantically associate captions with their image counterparts.

3. One of my favs is the <small>little</small>

this element has been redefined and can be used for small print such as copy right. this is a great tools to unitilize for anyone

4. No More Types for Scripts and Links

You possibly still add the type attribute to your link and script tags.

 <link rel="stylesheet" href="path/to/stylesheet.css" type="text/css" />  
 <script type="text/javascript" src="path/to/script.js">  

This is no longer necessary. It’s implied that both of these tags refer to stylesheets and scripts, respectively. As such, we can remove the type attribute all together.

    <link rel="stylesheet" href="path/to/stylesheet.css" />  
    <script src="path/to/script.js">  

5. HTML5 nifty things with your list items

Web browsers have understand NEW attribute that can be applied to elements, called contenteditable. They allow a user to edit content within the element

<ul contenteditable="true">  
<li>list item 1</li>	
<li>list item 2</li>	
<li>list item 3</li>	
</ul>

6. Form Fields with ease

We are also going to use some of HTML5’s new input types and attributes to create more meaningful fields and use less unnecessary classes and ids:

  • email, for the email field
  • tel, for the telephone field
  • number, for the credit card number and security code
  • required, for required fields
  • placeholder, for the hints within some of the fields
  • autofocus, to put focus on the first input field when the page loads
<form id=payment>
<fieldset>
<legend>Your details</legend>
<label for=name>Name</label>
<input id=name name=name type=text placeholder="First and last name" required autofocus>
<abel for=email>Email</label>
<input id=email name=email type=email placeholder="example@domain.com" required>
<label for=phone>Phone</label>
<input id=phone name=phone type=tel placeholder="Eg. +447500000000" required>
<button type=submit>Buy it!</button>
</fieldset>
</form>

7. The Semantic Header and Footer

No more <div> crazy

<div id="header"></div>
<div id="container"></div>
<div id="footer"></div>

Divs, the no semantic structure even when you assign an ID or class. With HTML5 header, section and footer mark-up to make it look nice

<header></header>
<section></section>
<footer></footer>

8. Internet Explorer and HTML5

Unfortunately, that dang Internet Explorer requires a bit of wrangling in order to understand the new HTML5 elements. All elements, by default, have a display of inline. In order to ensure that the new HTML5 elements render correctly as block level elements, it’s necessary at this time to style them as such.

header, footer, article, section, nav, menu, hgroup {  
display: block;  
}

Unfortunately, Internet Explorer will still ignore these stylings, because it has no clue what, as an example, the header element even is. Luckily, there is an easy fix:

document.createElement("article");  
document.createElement("footer");  
document.createElement("header");  
document.createElement("hgroup");  
document.createElement("nav");  
document.createElement("menu");  

Strangely enough, this code seems to trigger Internet Explorer. To simply this process for each new application, Remy Sharp created a script, commonly referred to as the HTML5 shiv. This script also fixes some printing issues as well.

<!--[if IE]>  
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>  
<![endif]-->  

9. hgroup

Imagine that, in my site’s header, I had the name of my site, immediately followed by a subheading. While we can use an <h1> and <h2> tag, respectively, to create the mark-up, there still wasn’t, as of HTML4, an easy way to semantically illustrate the relationship between the two. Additionally, the use of an h2 tag presents more problems, in terms of hierarchy, when it comes to displaying other headings on the page. By using the hgroup element, we can group these headings together, without affecting the flow of the document’s outline.

<header>  
<hgroup>  
<h1> Recall Fan Page </h1>  
<h2> Only for people who want the memory of a lifetime. </h2> 
</hgroup>

10. HTML Snippet

<div id="myDiv" data-custom-attr="My Value"> Bla Bla </div>  

Retrieve Value of the Custom Attribute

var theDiv = document.getElementById('myDiv');  
var attr = theDiv.getAttribute('data-custom-attr');  
alert(attr); // My Val  

It can also even be used in your CSS, like for this silly and lame CSS text changing example.

<!DOCTYPE html>  	  
<html lang="en">  
<head>  
<meta charset="utf-8">  
<title>Sort of Lame CSS Text Changing</title>  
<style>  	  
h1 { position: relative; }  
h1:hover { color: transparent; }  	
h1:hover:after {  
    content: attr(data-hover-response);  
    color: black;  
    position: absolute;  
    left: 0;  	  
}  
</style>  
</head>  
<body>  
<h1 data-hover-response="I Said Don't Touch Me!"> Don't Touch Me  </h1>    
</body>  
</html>