Mar
29
2011

deneyin işe yarar ping servisleri ile googleda ön sırada çıkın

Sitenizin indexlenmesi için otomatik ping atın deneyin işe yarar

« : 18 Mart 2010, 19:58:59 »

——————————————————————————–

Yeni webmasterların yine çokca duyduğu terimlerin başında geliyor sanırım ping atmak. Hemen ping atmanın ne olduğunu ve nasıl yapıldığını açıklayayım. Ping atmak kısacası arama motoru botlarını sitenize çağırmaktır. Özellikle WordPress’in çok gelişmiş bir pingleme sistemi vardır. Siz yazı yazar yazmaz ping servisi sayesinde Google’a ping atar ve örümcekler de sitenize uğrar. Eğer elle ping atmak istiyorsanız başlıca şu siteleri önerebilirim:Güncel Blog Arama Ping HizmetiAuto PingerPing-o-maticBen şahsen her zaman WordPress kullandığım için sadece WordPress’in ping atma özelliğinden yararlanıyorum. Bunun içinse şu ayarlamayı yapabilirsiniz. Ayarlar sekmesinden yazma ayarlarına gidin. Oradan servisleri güncelle seçeneğine eklemek istediğiniz ping servislerini ekleyin. Benim kullandığım ping servisleri ise şunlar:

Kod: Linklerin Gorulmesine izin Verilmiyor. Ucretsiz Uye Olun veya Uye iseniz Giris Yapin

http://rpc.pingomatic.com/http://api.moreover.com/pinghttp://api.my.yahoo.com/rss/pinghttp://blogsearch.google.com/ping/RPC2http://ping.bitacoras.comhttp://ping.feedburner.comhttp://ping.syndic8.com/xmlrpc.phphttp://rpc.blogrolling.com/pinger/http://rpc.icerocket.com:10080/http://rpc.technorati.com/rpc/pinghttp://rpc.weblogs.com/RPC2http://topicexchange.com/RPC2http://www.blogdigger.com/RPC2http://www.blogoole.com/ping/http://www.popdex.com/addsite.phphttp://www.wasalive.com/ping/http://www.weblogues.com/RPC/http://api.feedster.com/pinghttp://ping.amagle.com/http://ping.blo.gs/http://ping.rootblog.com/rpc.phphttp://ping.weblogalot.com/rpc.phphttp://rcs.datashed.net/RPC2/http://rpc.blogbuzzmachine.com/RPC2http://rpc.newsgator.com/http://www.blogoon.net/ping/http://www.blogsnow.com/pinghttp://www.blogstreet.com/xrbin/xmlrpc.cgihttp://www.lasermemory.com/lsrpc/http://www.newsisfree.com/RPCCloudhttp://www.snipsnap.org/RPC2http://blogsearch.google.com/ping/RPC2http://1470.net/api/pinghttp://api.feedster.com/pinghttp://api.moreover.com/RPC2http://api.moreover.com/pinghttp://api.my.yahoo.com/RPC2http://api.my.yahoo.com/rss/pinghttp://bblog.com/ping.phphttp://bitacoras.net/pinghttp://blog.goo.ne.jp/XMLRPChttp://blogdb.jp/xmlrpchttp://blogmatcher.com/u.phphttp://bulkfeeds.net/rpchttp://coreblog.org/ping/http://mod-pubsub.org/kn_apps/blogchatthttp://www.lasermemory.com/lsrpc/http://ping.amagle.com/http://ping.bitacoras.comhttp://ping.blo.gs/http://ping.bloggers.jp/rpc/http://ping.cocolog-nifty.com/xmlrpchttp://ping.blogmura.jp/rpc/http://ping.exblog.jp/xmlrpchttp://ping.feedburner.comhttp://ping.myblog.jphttp://ping.rootblog.com/rpc.phphttp://ping.syndic8.com/xmlrpc.phphttp://ping.weblogalot.com/rpc.phphttp://ping.weblogs.se/http://pingoat.com/goat/RPC2http://rcs.datashed.net/RPC2/http://rpc.blogbuzzmachine.com/RPC2

Ping Atmanın FaydalarıPing atmanın tek yararını söyleyebilirim o da siteniz indexlenir. Zaten hitin ilk aşaması da indextir. İndexiniz olmadan hit de alamazsınız.alıntı

0
Şub
20
2011

create Creating a Mouseover Fade Effect with jQuery My last little jQuery tutorial was an alternative to using CSS to create an image change on a mouseover. Now I want to take that one step further and add a fade effect. For my example, I am going to make a black and white image fade into a color image. To achieve this effect I am going to introduce the animate function

Creating a Mouseover Fade Effect with jQuery

 

My last little jQuery tutorial was an alternative to using CSS to create an image change on a mouseover. Now I want to take that one step further and add a fade effect. For my example, I am going to make a black and white image fade into a color image. To achieve this effect I am going to introduce the animate function. There are tons of possibilities in regards to jQuery’s animate function, but for this tutorial, I’m going to keep it simple by just using it to do one thing.

First things first, download jQuery. Grab the Production minified version off of their site. Next, get two images. I used the following.

cbavota-bwcbavota


Add the jQuery script between your head tags.

<script type='text/javascript' src='http://yoursite.com/jquery.js'></script>

Here is the function.

<script type='text/javascript'>
$(document).ready(function(){
$("img.a").hover(
function() {
$(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
$(this).stop().animate({"opacity": "1"}, "slow");
});

});
</script>

Here is the CSS.

<style>

div.fadehover {
	position: relative;
	}

img.a {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 10;
        }

img.b {
	position: absolute;
	left: 0;
	top: 0;
	}

</style>

And here is the body code.

<div class="fadehover">
<img src="cbavota-bw.jpg" alt="" class="a" />
<img src="cbavota.jpg" alt="" class="b" />
</div>

All together you got something that looks like this.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery Hover Effect</title>
<script type='text/javascript' src='jquery.js'></script>
<script type='text/javascript'>
$(document).ready(function(){

$("img.a").hover(
function() {
$(this).stop().animate({"opacity": "0"}, "slow");
},
function() {
$(this).stop().animate({"opacity": "1"}, "slow");
});

});
</script>
<style>
div.fadehover {
	position: relative;
	}

img.a {
	position: absolute;
	left: 0;
	top: 0;
        z-index: 10;
	}

img.b {
	position: absolute;
	left: 0;
	top: 0;
	}
</style>
</head>

<body>
<div class="fadehover">
<img src="cbavota-bw.jpg" alt="" class="a" />
<img src="cbavota.jpg" alt="" class="b" />
</div>
</body>
</html>

Test it out below:

NOTE: If you are using jQuery with WordPress, you need to replace all the dollar signs ($) with the word jQuery due to other Javascript libraries that use the dollar sign.

0
Şub
19
2011

JQUERY referance jquery web site jquery documentation jquery dökümanları kaynakları

jQuery API Reference

There are a number of alternative resources for browsing the API.

jQuery UI Reference

0
Şub
19
2011

jQuery From Scratch: jQuery Rollovers Using “this” sample app

If you’ve been programming in PHP, or other object oriented languages, you may have come across “this” or “self”.  With jQuery, we can write $(this) to select an element in the DOM (Document Object Model).  The best way to demonstrate this is with a simple example.

Let’s write a short script to do the classic image rollover:

$(function() {
  $("#menu img").hover(function() {
    $(this).attr("src", $(this).attr("src").split(".").join("-hover."));
  }, function() {
    $(this).attr("src", $(this).attr("src").split("-hover.").join("."));
  });
});

You might have your markup something like this:

<ul id="menu">
	<li><a href="#"><img src="item1.gif" /></a></li>
	<li><a href="#"><img src="item2.gif" /></a></li>
	<li><a href="#"><img src="item3.gif" /></a></li>
</ul>

So what does the code do? Firstly, we initialize the document.ready() function – using the shorthand notation. You can read more about this in the 1st jQuery tutorial. Within this function, we attach the “hover” event to the images which together create the menu. You can see in the sample HTML markup that there are 3 images. These images are contained within unordered list elements.

Look one line down from where we attach the hover event and you’ll see:

$(this).attr("src", $(this).attr("src").split(".").join("-hover."));

This is where things start to get interesting. $(this) is referencing the image that is hovered over. So couldn’t we have just written $(”#menu img”) instead of $(this)? Well… no. This is because $(”#menu img”) will select all the images instead of just the image that is being hovered over. We could have added a unique class (or ID) to each image and then have selected that for each image. The problem with this is that it involves a whole lot more of unnecessary code. We’d need to attach the hover event to each image.

The next part of that line is: “.attr(…)”. We can use this to change a property to a defined value. We can also use this to get the value of a defined property. For example, the following code changes the SRC property to “foo.gif”:

$("img#example").attr("src", "foo.gif");

We can also assign the current value of the SRC property to a variable by writing:

var srcValue = $("img#example").attr("src");

In the rollover code, we use both. We assign the SRC property a new value by taking the current value, splitting it at the “.” (period) and joining “-hover.” onto the end. You can read more about the “split” function. Essentially, this function splits a string into an array at the delimiter. In this case, we define the “.” (period) as the delimiter.

We pretty much do the reverse for when the cursor moves off the image. We define the delimiter as “-hover.”, thus removing these characters from the SRC property.

0
Şub
03
2011

JQuery – Star Comment Rating Here is a nice little rating effect. This does not include the PHP, it is only the JavaScript, HTML, CSS, and Images. If you like this, I do have the PHP script that I created, but will not support, and I threw together quite quickly. But, what the heck, back to this post now.

JQuery – Star Comment Rating

Here is a nice little rating effect. This does not include the PHP, it is only the JavaScript, HTML, CSS, and Images. If you like this, I do have the PHP script that I created, but will not support, and I threw together quite quickly. But, what the heck, back to this post now.

Look below and you can see what will be created by the time we are done with this project.

Skip to full source code || Download Source in .zip

What we start with is one HTML file, JQUERY library, star_rating.js (contains all the effects), and the image folder with some images.

First let’s take a look at the file structure.

star-rating file structure

Right now I contain all the CSS in the html file, out of shear laziness, and so you don’t have an extra file with a small amount of CSS in it.

So let’s talk about the html.

Everything except the hidden form field that contains the final rating selected is contained within the rating_cont div.

Inside the main rating_cont div is three more divs.

  1. rating_btns div.
  2. rating_on div.
  3. rated div.
<div id="rating_cont">
<div id="rating_btns"></div>
<div id="rating_on" >&nbsp;</div>
<div id="rated"></div>
</div>
<input type="hidden" id="rating_output" name="rating_output" value="not rated" />

 

Now that we have the main divs setup, let’s add some of the style so we can see what we are working with.

We will add the following CSS to the rating_cont, our main div.

#rating_cont { background: #1E1D1C url(images/rating_background.jpg) top left no-repeat; border: 1px solid #F9BA0D; width: 140px; height: 23px; text-align: left; margin-left: 6px;}

 

This puts the background image of the stars ‘off’ and creates our height, width, border, and background for our main container.

Next, let’s create the CSS and html for the rating_btns div.

The rating_btns div will have an unordered list with the actual ratings in it.

Look below.

<ul>
<li>0.5</li>
<li>1.0</li>
<li>1.5</li>
<li>2.0</li>
<li>2.5</li>
<li>3.0</li>
<li>3.5</li>
<li>4.0</li>
<li>4.5</li>
<li>5.0</li>
</ul>

 

If you’re doing the code step by step, I’m sure you noticed that this looks pretty ugly right now. Let’s add the CSS to the rating_btns div and the ul we have.

The rating_btns div needs to be above the rating_on div that we will create next, so we will give it a relative positioning and a z-index of 100. We also add the height and width to define the container of our <li> links.

Inside the rating_btns div is our <ul> and it’s <li>. We do not want our <ul> or our <li> to have any margin or padding. The <li> needs to be 14px wide. Guess why. 14 x 100 = 140! Yup, you got it. That is the width of our container, amazing, I know. We are going to float them left, give them a block display so they don’t go over each other, and last but not least, change the font display. We will change the font to 1px, and the same color as the background. I’m sure you’re asking; why not just have them empty and not have any text in there at all? Well, we will use this text to tell our JQuery script what you hovered over.

Here is the CSS for this.

#rating_btns { position: relative; z-index: 100; width: 140px; height: 21px;}
#rating_btns ul, #rating_btns li  { padding: 0; margin: 0; }
#rating_btns li { float: left; width: 14px; height: 21px; display: block; font-size: 1px; cursor: pointer; color: #1E1D1C; }

 

Next, look at our rating_on div. Just as it says, it is our div that contains our stars that are “ON”. We use a quite unique way of doing this. We give it a background image of the “on” stars, but change it’s width based upon what we hover over. That’s the reason we had to give the rating_btns a relative positioning with a z-index, and this div we will also give a relative positioning, but a z-index of 50. We will also set the width to 0px initially, so it doesn’t show before we hover over it.

Here is the HTML for this:

#rating_on { background: url(images/rating_onbackground.jpg) top left no-repeat; width: 0px; height: 21px; position: relative; z-index: 50; top: -21px; }
<div id="rating_on" >&nbsp;</div>

 

On to our last div, our rating div, this contains three smaller divs that act as cells, one containing the selected rating, another containing the image of the stars, and the last one containing our edit link.

I still haven’t gotten to the JQuery yet, so I will just show you the CSS, and HTML for this.

#rated { display: none; width: 138px; padding: 3px 0px 3px 2px; height: 23px; background-color: #1E1D1C; height: 17px;font-size: 11px;color: #FFC910;}
#rated div { display: block; float: left; }
#rating { font-size: 11px; font-family: Arial, Helvetica, sans-serif; color: #FFC910; padding-left: 3px; width: 22px; }
#small_stars { height: 11px; width: 69px; background-image: url(images/stars_small_sprite.jpg); background-position: 0px -11px; font-size:1px; line-height: 11px; margin-top:3px; }
#rate_edit { line-height: 17px; font-size: 11px; font-family: Arial, Helvetica, sans-serif; color: #FFF; padding-left: 9px; cursor: pointer; }
#rate_edit:hover { text-decoration: underline; }
<div id="rated">
<div id="rating" style="height: 17px; line-height: 17px;">not rated</div>
<div> &#8211; &nbsp;</div>
<div id="small_stars">&nbsp;</div>
<div id="rate_edit">edit</div>
</div>

 

Since this will be used to send a rating from a form, we will add a hidden form field to be sent. This will be updated from JQuery.

<input type="hidden" id="rating_output" name="rating_output" value="not rated" />

 

Ok, on to the fun stuff, the JQuery.

This will have a total of six functions, NOT including the document.ready function.

  1. rateWidth function
  2. starSprite function
  3. hover function *JQuery
  4. mouseout function *JQuery
  5. click function *JQuery
  6. edit function *JQuery

With JQuery we need to surround it’s functions with $(document).ready(function()).

In saying that, keep that in mind when you look at the source code. If you don’t know what I am talking about, check out the full source code at the end of this post, or the downloadable source code.

1. rateWidth function
This function accepts the rating variable from our JQuery functions, converts it to an Integer, uses a switch statement to determine the width value, then returns the width to make our rating_on div show the stars. (shows the stars).

function rateWidth($rating){
$rating = parseFloat($rating);
switch ($rating){
case 0.5: $width = "14px"; break;
case 1.0: $width = "28px"; break;
case 1.5: $width = "42px"; break;
case 2.0: $width = "56px"; break;
case 2.5: $width = "70px"; break;
case 3.0: $width = "84px"; break;
case 3.5: $width = "98px"; break;
case 4.0: $width = "112px"; break;
case 4.5: $width = "126px"; break;
case 5.0: $width = "140px"; break;
default:  $width =  "84px";
}
return $width;
}

 

2. starSprite function
I used two different methods for creating the stars. One uses less HTML, and one uses more. For the small stars that show up when you make a rating, I wanted to use less HTML and used the sprite method to show the rating. But it does the same thing as the rateWidth but determines the background positioning based on the rating provided.

function starSprite($rating){
$rating = parseFloat($rating);
switch ($rating){
case 0.5: $pos = "-11px"; break;
case 1.0: $pos = "-22px"; break;
case 1.5: $pos = "-33px"; break;
case 2.0: $pos = "-44px"; break;
case 2.5: $pos = "-55px"; break;
case 3.0: $pos = "-66px"; break;
case 3.5: $pos = "-77px"; break;
case 4.0: $pos = "-88px"; break;
case 4.5: $pos = "-99px"; break;
case 5.0: $pos = "-110px"; break;
default:  $pos =  "-77px";
}
return $pos;
}

 

3. hover function *JQuery
The hover function will detect the cursor hovering over our <li>’s and the value of it and then send the value to the rateWidth function to get our width. It then assigns the width to the #rating_on div.

$('#rating_btns li').hover(function(){
$rating = $(this).text();
$('#rating_on').css('width', rateWidth($rating));
});

 

4. mouseout function
The mouseout function does just that, tells what stars should be showing on mouseout. But we do not want the stars to be reset every time we go off the stars, especially if we already selected a rating. So we grab the value of our #rating div and if it is “not rated” we set our width to 0px but if it doesn’t equal “not rated” we set the width of it’s set value. This way if you have selected a rating it defaults back to it when you mouseout.

$('#rating_btns li').mouseout(function(){
$rating = $('#rating').text();
if($rating == "not rated"){
$('#rating_on').css('width', "0px");
}
else{
$('#rating_on').css('width', rateWidth($rating));
}
});

 

5. click function
This function has a little bit more going on than the other ones. When you click the <li> it first grabs the value of the clicked <li> assigns it to the #rating div, uses starSprite function to assign the background position for the #small_stars div, then hides the #rating_btns div, and the #rating_on div. Once hidden, it nicely fades in the #rated div.

$('#rating_btns li').click(function(){
$rating = $(this).text();
$('#rating').text($rating);
$('#rating_output').val($rating);
$pos = starSprite($rating);
$('#small_stars').css('background-position', "0px " + $pos );
$('#rating_btns').hide();
$('#rating_on').hide();
$('#rated').fadeIn();
});

 

6. edit function
This function just hides the #rated div and fades in the two divs we just hid. The #rating_div and the #rating_btns div.

$('#rate_edit').click(function(){
$('#rated').hide();
$('#rating_btns').fadeIn();
$('#rating_on').fadeIn();
});

 

Bam… we’re done.

FULL SOURCE CODE

Here is the completed code for your viewing pleasure.

HTML (star_rating.html) -

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JQuery-Star Comment Rating</title>
<script type="text/javascript" src="js/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/star_rating.js"></script>
<style type="text/css">
#rating_cont { background: #1E1D1C url(images/rating_background.jpg) top left no-repeat; border: 1px solid #F9BA0D; width: 140px; height: 23px; text-align: left; margin-left: 6px;}
#rating_on { background: url(images/rating_onbackground.jpg) top left no-repeat; width: 0px; height: 21px; position: relative; z-index: 50; top: -21px; }
#rated { display: none; width: 138px; padding: 3px 0px 3px 2px; height: 23px; background-color: #1E1D1C; height: 17px;font-size: 11px;color: #FFC910;}
#rated div { display: block; float: left; }
#rating { font-size: 11px; font-family: Arial, Helvetica, sans-serif; color: #FFC910; padding-left: 3px; width: 22px; }
#small_stars { height: 11px; width: 69px; background-image: url(images/stars_small_sprite.jpg); background-position: 0px -11px; font-size:1px; line-height: 11px; margin-top:3px; }
#rate_edit { line-height: 17px; font-size: 11px; font-family: Arial, Helvetica, sans-serif; color: #FFF; padding-left: 9px; cursor: pointer; }
#rate_edit:hover { text-decoration: underline; }
#rating_btns { position: relative; z-index: 100; width: 140px; height: 21px;}
#rating_btns ul, #rating_btns li  { padding: 0; margin: 0; }
#rating_btns li { float: left; width: 14px; height: 21px; display: block; font-size: 1px; cursor: pointer; color: #1E1D1C;
}
</style>
</head>
<body>
<div id="rating_cont">
<div id="rating_btns">
<ul>
<li>0.5</li>
<li>1.0</li>
<li>1.5</li>
<li>2.0</li>
<li>2.5</li>
<li>3.0</li>
<li>3.5</li>
<li>4.0</li>
<li>4.5</li>
<li>5.0</li>
</ul>
</div>
<div id="rating_on" >&nbsp;</div>
<div id="rated">
<div id="rating" style="height: 17px; line-height: 17px;">not rated</div>
<div> &#8211; &nbsp;</div>
<div id="small_stars">&nbsp;</div>
<div id="rate_edit">edit</div>
</div>
</div>
<input type="hidden" id="rating_output" name="rating_output" />
</body>
</html>

 

JQuery/JavaScript (star_rating.js) -

/*
* Written by eligeske
* downloaded from eligeske.com
* have fun. nerd.
*/
$(document).ready(function(){
// hover
$('#rating_btns li').hover(function(){
$rating = $(this).text();
$('#rating_on').css('width', rateWidth($rating));
});
// mouseout
$('#rating_btns li').mouseout(function(){
$rating = $('#rating').text();
if($rating == "not rated"){
$('#rating_on').css('width', "0px");
}
else{
$('#rating_on').css('width', rateWidth($rating));
}
});
//click
$('#rating_btns li').click(function(){
$rating = $(this).text();
$('#rating').text($rating);
$('#rating_output').val($rating);
$pos = starSprite($rating);
$('#small_stars').css('background-position', "0px " + $pos );
$('#rating_btns').hide();
$('#rating_on').hide();
$('#rated').fadeIn();
});
//edit
$('#rate_edit').click(function(){
$('#rated').hide();
$('#rating_btns').fadeIn();
$('#rating_on').fadeIn();
});
function rateWidth($rating){
$rating = parseFloat($rating);
switch ($rating){
case 0.5: $width = "14px"; break;
case 1.0: $width = "28px"; break;
case 1.5: $width = "42px"; break;
case 2.0: $width = "56px"; break;
case 2.5: $width = "70px"; break;
case 3.0: $width = "84px"; break;
case 3.5: $width = "98px"; break;
case 4.0: $width = "112px"; break;
case 4.5: $width = "126px"; break;
case 5.0: $width = "140px"; break;
default:  $width =  "84px";
}
return $width;
}
function starSprite($rating){
$rating = parseFloat($rating);
switch ($rating){
case 0.5: $pos = "-11px"; break;
case 1.0: $pos = "-22px"; break;
case 1.5: $pos = "-33px"; break;
case 2.0: $pos = "-44px"; break;
case 2.5: $pos = "-55px"; break;
case 3.0: $pos = "-66px"; break;
case 3.5: $pos = "-77px"; break;
case 4.0: $pos = "-88px"; break;
case 4.5: $pos = "-99px"; break;
case 5.0: $pos = "-110px"; break;
default:  $pos =  "-77px";
}
return $pos;
}
});

 

I hope it works for you all. If you have any questions feel free to leave a comment.

0
Şub
03
2011

Simple Tabs w/ CSS & jQuery I know there are quite a few tutorials out there that demonstrate how to create tabs with CSS & jQuery, but I decided to create my own as well. I’m not sure if the techniques are the same, but hopefully this tutorial will be easy to understand even for a beginner.

 

Simple Tabs w/ CSS & jQuery

I know there are quite a few tutorials out there that demonstrate how to create tabs with CSS & jQuery, but I decided to create my own as well. I’m not sure if the techniques are the same, but hopefully this tutorial will be easy to understand even for a beginner.

For those who are not familiar with jQuery, check out their site for a general overview, and you can also follow up with the various tutorials out there.
Easy Tabs Tutorial with CSS & jQuery

View Demo

Step1. Wireframe – HTML & CSS

Use an unordered list for your tabs, and follow up with the “tab_container” container right below it. Make note that each list item (tabs) has an attribute of “href” that matches the ID of the “.tab_content” div. This will be very important once we have jQuery pull off the actions. Also keep in mind that I used generic names like “tab1″ so its easier to understand. In reality, you should be using keywords so it can semantic and also benefit you in SEO.

HTML

<ul>
    <li><a href="#tab1">Gallery</a></li>
    <li><a href="#tab2">Submit</a></li>
</ul>

<div>
    <div id="tab1">
        <!--Content-->
    </div>
    <div id="tab2">
       <!--Content-->
    </div>
</div>

If you have tried to create tabs before with CSS, you probably have experienced some frustration with getting the borders on the tabs correctly aligned. Below is a common problem that most people will run into.

Easy Tabs Tutorial with CSS & jQuery

Here is a solution I came up with that took care of this annoying issue. Check out the image below and also take a look at the CSS and its supporting comments for a better understanding.

Easy Tabs Tutorial with CSS & jQuery

Tabs CSS

ul.tabs {
	margin: 0;
	padding: 0;
	float: left;
	list-style: none;
	height: 32px; /*--Set height of tabs--*/
	border-bottom: 1px solid #999;
	border-left: 1px solid #999;
	width: 100%;
}
ul.tabs li {
	float: left;
	margin: 0;
	padding: 0;
	height: 31px; /*--Subtract 1px from the height of the unordered list--*/
	line-height: 31px; /*--Vertically aligns the text within the tab--*/
	border: 1px solid #999;
	border-left: none;
	margin-bottom: -1px; /*--Pull the list item down 1px--*/
	overflow: hidden;
	position: relative;
	background: #e0e0e0;
}
ul.tabs li a {
	text-decoration: none;
	color: #000;
	display: block;
	font-size: 1.2em;
	padding: 0 20px;
	border: 1px solid #fff; /*--Gives the bevel look with a 1px white border inside the list item--*/
	outline: none;
}
ul.tabs li a:hover {
	background: #ccc;
}
html ul.tabs li.active, html ul.tabs li.active a:hover  { /*--Makes sure that the active tab does not listen to the hover properties--*/
	background: #fff;
	border-bottom: 1px solid #fff; /*--Makes the active tab look like it's connected with its content--*/
}

Tab Content CSS

.tab_container {
	border: 1px solid #999;
	border-top: none;
	overflow: hidden;
	clear: both;
	float: left; width: 100%;
	background: #fff;
}
.tab_content {
	padding: 20px;
	font-size: 1.2em;
}

Step 2. Activate the Tabs – jQuery

For those who are not familiar with jQuery, check out their site for a general overview.
The following script contains comments explaining which jQuery actions are being performed.

$(document).ready(function() {

	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul.tabs li").click(function() {

		$("ul.tabs li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

});

Easy Tabs Tutorial with CSS & jQuery

View Demo

0
Şub
03
2011

Mega Drop Down Menus w/ CSS & jQuery mega drop down menus”.

 

Mega Drop Down Menus w/ CSS & jQuery

While in the process of redesigning 4wheelparts.com, I decided to explore new methods of working with our huge number of inventory and categories. I did some research and noticed a new trend for ecommerce sites in having what they call “mega drop down menus”.

According to usability expert Jakob Nielson, mega drop down menus tested to be more efficient for large scale websites.I decided to experiment with different ways of implementing this technique and would like to share how I achieved this method.

Given that regular drop-down menus are rife with usability problems, it takes a lot for me to recommend a new form of drop-down. But, as our testing videos show, mega drop-downs overcome the downsides of regular drop-downs. Thus, I can recommend one while warning against the other. – Jakob Nielsen – Alert Box

As I read his article he recommended that these kind of drop down menus should have a subtle time delay when hovering in and out of them. I decided to use the Hover Intent jQuery plugin to help me achieve this effect.

Mega Drop Down Menu - CSS & jQuery

View Demo

Step 1. Foundation – HTML

Just like all of my navigation tutorials, start by creating an unordered list. Since we will be using CSS Sprites for our navigation states, each link within the list item should have a unique class name to it.

<ul id="topnav">
    <li><a href="#">Home</a></li>
    <li><a href="#">Products</a></li>
    <li><a href="#">Sale</a></li>
    <li><a href="#">Community</a></li>
    <li><a href="#">Store Locator</a></li>
</ul>

Step 2. Styling Foundation – CSS

Since our drop down menu will be using absolute positioning, be sure to add a relative positioning to the list item. Shoot the text off of the page by specifying a text-indent of -9999px. We will then replace each navigation link with an image by specifying an image path to each link class name.

ul#topnav {
	margin: 0; padding: 0;
	float:left;
	width: 100%;
	list-style: none;
	font-size: 1.1em;
}
ul#topnav li {
	float: left;
	margin: 0; padding: 0;
	position: relative; /*--Important--*/
}
ul#topnav li a {
	float: left;
	text-indent: -9999px; /*--Push text off of page--*/
	height: 44px;
}
ul#topnav li:hover a, ul#topnav li a:hover { background-position: left bottom; } /*--Hover State--*/
ul#topnav a.home {
	background: url(nav_home.png) no-repeat;
	width: 78px;
}
ul#topnav a.products {
	background: url(nav_products.png) no-repeat;
	width: 117px;
}
ul#topnav a.sale {
	background: url(nav_sale.png) no-repeat;
	width: 124px;
}
ul#topnav a.community {
	background: url(nav_community.png) no-repeat;
	width: 124px;
}
ul#topnav a.store {
	background: url(nav_store.png) no-repeat;
	width: 141px;
}

Step 3. Creating the Mega Sub Navigation – HTML

Add a class of “sub” right after your main navigation link and nest unordered lists within. Each nested unordered list will act as the nav columns of your mega drop down.
Mega Drop Down Menu

<ul id="topnav">
    <li><a href="#">Home</a></li>
    <li>
    	<a href="#">Products</a>
        <div>
            <ul>
                <li><h2><a href="#">Desktop</a></h2></li>
                <li><a href="#">Navigation Link</a></li>
                <li><a href="#">Navigation Link</a></li>
            </ul>
            <ul>
                <li><h2><a href="#">Laptop</a></h2></li>
                <li><a href="#">Navigation Link</a></li>
                <li><a href="#">Navigation Link</a></li>
            </ul>
            <ul>
                <li><h2><a href="#">Accessories</a></h2></li>
                <li><a href="#">Navigation Link</a></li>
                <li><a href="#">Navigation Link</a></li>
            </ul>
            <ul>
                <li><h2><a href="#">Accessories</a></h2></li>
                <li><a href="#">Navigation Link</a></li>
                <li><a href="#">Navigation Link</a></li>
            </ul>
        </div>
    </li>
    <li><a href="#">Sale</a></li>
    <li><a href="#">Community</a></li>
    <li><a href="#">Store Locator</a></li>
</ul>

Step 4. Styling Mega Sub Navigation – CSS

To get the sub nav to stick to the bottom left corner of the parent hovered nav, be sure to set an absolute position to the .sub container with the coordinate of top 44px and left 0px. For style, I added rounded corners to those browsers that support it (Firefox/Chrome/Safari).

Keep in mind when having multiple levels of nested lists, you need to override its conflicting properties. Check out the comments below.

ul#topnav li .sub {
	position: absolute; /*--Important--*/
	top: 44px; left: 0;
	z-index: 99999;
	background: #344c00 url(sub_bg.png) repeat-x; /*--Background gradient--*/
	padding: 20px 20px 20px;
	float: left;
	/*--Bottom right rounded corner--*/
	-moz-border-radius-bottomright: 5px;
	-khtml-border-radius-bottomright: 5px;
	-webkit-border-bottom-right-radius: 5px;
	/*--Bottom left rounded corner--*/
	-moz-border-radius-bottomleft: 5px;
	-khtml-border-radius-bottomleft: 5px;
	-webkit-border-bottom-left-radius: 5px;
	display: none; /*--Hidden for those with js turned off--*/
}
ul#topnav li .row { /*--If needed to break out into rows--*/
	clear: both;
	float: left;
	width: 100%;
	margin-bottom: 10px;
}
ul#topnav li .sub ul{
	list-style: none;
	margin: 0; padding: 0;
	width: 150px;
	float: left;
}
ul#topnav .sub ul li {
	width: 100%; /*--Override parent list item--*/
	color: #fff;
}
ul#topnav .sub ul li h2 { /*--Sub nav heading style--*/
	padding: 0;  margin: 0;
	font-size: 1.3em;
	font-weight: normal;
}
ul#topnav .sub ul li h2 a { /*--Sub nav heading link style--*/
	padding: 5px 0;
	background-image: none;
	color: #e8e000;
}
ul#topnav .sub ul li a {
	float: none;
	text-indent: 0; /*--Override text-indent from parent list item--*/
	height: auto; /*--Override height from parent list item--*/
	background: url(navlist_arrow.png) no-repeat 5px 12px;
	padding: 7px 5px 7px 15px;
	display: block;
	text-decoration: none;
	color: #fff;
}
ul#topnav .sub ul li a:hover {
	color: #ddd;
	background-position: 5px 12px ;/*--Override background position--*/
}

Step 5. Setting up jQuery & Hover Intent

For those who are not familiar with jQuery, do check out their site first and get an overview of how it works. I’ve shared a few tricks that I have picked up along the way, you can check those out as well.

Initial Step – Call the jQuery file

You can choose to download the file from the jQuery site, or you can use this one hosted on Google.

<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>

After calling the jQuery file, visit and download the latest Hover Intent jQuery Plugin. Save the file to your current directory, and call the file.

<script type="text/javascript" src="jquery.hoverIntent.minified.js"></script>

Step 6. Launching Code on Document Ready

Directly after the line where you called your jQuery and hover intent file, start a new <script> tag and start your code by using the $(document).ready event. This allows your jQuery code to run the instant the DOM is ready to be manipulated. The code you will be writing in the next few steps will all take place within.

$(document).ready(function() {
	//Code goes here
});

Step 7. Set Hover Over & Hover Out Events – jQuery

Note: When using the hover intent plugin, it requires each hover over and hover out state to be in its own function.

The Logic

When a drop down parent link is hovered over:

  1. Find .sub and fade it in (By default, we will fade the opacity down to 0)
  2. Check if a .row exists (in case you want more than one row in the drop down)
  3. If .row does exists, find the widest row and set the width of the .sub container.
  4. If .row does not exist, set the width of the .sub container.

On hover out:

  1. Find .sub and fade it out (Opacity 0)
  2. Hide .sub (Display none – so it is completely out of the way)

The following script contains comments explaining which jQuery actions are being performed.

//On Hover Over
function megaHoverOver(){
    $(this).find(".sub").stop().fadeTo('fast', 1).show(); //Find sub and fade it in
    (function($) {
        //Function to calculate total width of all ul's
        jQuery.fn.calcSubWidth = function() {
            rowWidth = 0;
            //Calculate row
            $(this).find("ul").each(function() { //for each ul...
                rowWidth += $(this).width(); //Add each ul's width together
            });
        };
    })(jQuery); 

    if ( $(this).find(".row").length > 0 ) { //If row exists...

        var biggestRow = 0;	

        $(this).find(".row").each(function() {	//for each row...
            $(this).calcSubWidth(); //Call function to calculate width of all ul's
            //Find biggest row
            if(rowWidth > biggestRow) {
                biggestRow = rowWidth;
            }
        });

        $(this).find(".sub").css({'width' :biggestRow}); //Set width
        $(this).find(".row:last").css({'margin':'0'});  //Kill last row's margin

    } else { //If row does not exist...

        $(this).calcSubWidth();  //Call function to calculate width of all ul's
        $(this).find(".sub").css({'width' : rowWidth}); //Set Width

    }
}
//On Hover Out
function megaHoverOut(){
  $(this).find(".sub").stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
      $(this).hide();  //after fading, hide it
  });
}

Step 8. Set Custom Configurations & Trigger Function

Now that we declared the hover over and hover out function in the above step, its now time to set the custom configurations and call the hover intent function.

//Set custom configurations
var config = {
     sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
     interval: 100, // number = milliseconds for onMouseOver polling interval
     over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
     timeout: 500, // number = milliseconds delay before onMouseOut
     out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};

$("ul#topnav li .sub").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default
$("ul#topnav li").hoverIntent(config); //Trigger Hover intent with custom configurations

For more detailed explanation of how hover intent works, check out their website.

Conclusion

Keep in mind that this script calculates the width of your .sub container (adding up all UL’s per row) and automatically adjusts it. If you would like to specify your own custom width, you can delete that portion of the code and specify a static width in your CSS. This all depends on what you are trying to add in your mega drop down, and each scenario may be different. I hope you grasped the basic concepts of this tutorial so you can make your own custom mega drop down for future projects. If you have any questions, concerns, or suggestions, please let me know!

Mega Drop Down Menu - CSS & jQuery

View Demo

Inspiration Elsewhere

Now that you know how to create a mega drop down from scratch, check out some of these sites for inspiration.
Mega Drop Menu
Mega Drop Menu
Mega Drop Menu
Mega Drop Menu
Mega Drop Menu
Mega Drop Menu
Mega Drop Menu

0
Şub
03
2011

Inline Modal Window w/ CSS and jQuery samples örnek uygulama

 

Inline Modal Window w/ CSS and jQuery

There are many elegant and easy to install modal window (Popup) plugins out there, but there are times where the script interferes with some of the logic processed on the page. I recently had a situation where I was not able to use plugins like fancybox and prettyPhoto so I had to create my own modal window that pulled inline html within the page. Here is how I approached this situation:

Inline Modal Window w/ CSS and jQuery

View Demo

HTML

We begin by adding a <a> tag with the following attributes:

  • href - #?w=500 specifies the width of the popup
  • rel – Set a unique rel for this Popup
  • class="poplight" – Class needed to trigger popup
<a href="#?w=500" rel="popup_name">Learn More</a>

Next we set up the inline markup for the popup. This can be placed anywhere on the page, I set this towards the bottom of the content. Notice that the id of the popup matches the <a> tag’s rel attribute. This is what associates the link and popup together.

<div id="popup_name">
    <h2>Turtle Power</h2>
    <p>I <3 Turtles.</p>
</div>

CSS

Take a look at the comments below for an explanation of the styles. Notice that we don’t specify the margin on the .popup_block in the CSS. Since the popups may vary in size, we will have jQuery calculate this for us in the next step.

#fade { /*--Transparent background layer--*/
	display: none; /*--hidden by default--*/
	background: #000;
	position: fixed; left: 0; top: 0;
	width: 100%; height: 100%;
	opacity: .80;
	z-index: 9999;
}
.popup_block{
	display: none; /*--hidden by default--*/
	background: #fff;
	padding: 20px;
	border: 20px solid #ddd;
	float: left;
	font-size: 1.2em;
	position: fixed;
	top: 50%; left: 50%;
	z-index: 99999;
	/*--CSS3 Box Shadows--*/
	-webkit-box-shadow: 0px 0px 20px #000;
	-moz-box-shadow: 0px 0px 20px #000;
	box-shadow: 0px 0px 20px #000;
	/*--CSS3 Rounded Corners--*/
	-webkit-border-radius: 10px;
	-moz-border-radius: 10px;
	border-radius: 10px;
}
img.btn_close {
	float: right;
	margin: -55px -55px 0 0;
}
/*--Making IE6 Understand Fixed Positioning--*/
*html #fade {
	position: absolute;
}
*html .popup_block {
	position: absolute;
}

Step 3. Setting up jQuery

For those who are not familiar with jQuery, do check out their site first and get an overview of how it works. I’ve shared a few tricks that I have picked up along the way, you can check those out as well.

Initial Step – Call the jQuery file

You can choose to download the file from the jQuery site, or you can use this one hosted on Google.

<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>

Directly after the line where you called your jQuery, start a new <script> tag and start your code by using the $(document).ready event. This allows your jQuery code to run the instant the DOM is ready to be manipulated. The code you will be writing in the next few steps will all take place within.

$(document).ready(function() {
	//Code goes here
});

Step 4. Activate Popup with jQuery

The following script contains comments explaining which jQuery actions are being performed.

//When you click on a link with class of poplight and the href starts with a #
$('a.poplight[href^=#]').click(function() {
    var popID = $(this).attr('rel'); //Get Popup Name
    var popURL = $(this).attr('href'); //Get Popup href to define size

    //Pull Query & Variables from href URL
    var query= popURL.split('?');
    var dim= query[1].split('&');
    var popWidth = dim[0].split('=')[1]; //Gets the first query string value

    //Fade in the Popup and add close button
    $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#"><img src="close_pop.png" title="Close Window" alt="Close" /></a>');

    //Define margin for center alignment (vertical   horizontal) - we add 80px to the height/width to accomodate for the padding  and border width defined in the css
    var popMargTop = ($('#' + popID).height() + 80) / 2;
    var popMargLeft = ($('#' + popID).width() + 80) / 2;

    //Apply Margin to Popup
    $('#' + popID).css({
        'margin-top' : -popMargTop,
        'margin-left' : -popMargLeft
    });

    //Fade in Background
    $('body').append('<div id="fade"></div>'); //Add the fade layer to bottom of the body tag.
    $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); //Fade in the fade layer - .css({'filter' : 'alpha(opacity=80)'}) is used to fix the IE Bug on fading transparencies 

    return false;
});

//Close Popups and Fade Layer
$('a.close, #fade').live('click', function() { //When clicking on the close or fade layer...
    $('#fade , .popup_block').fadeOut(function() {
        $('#fade, a.close').remove();  //fade them both out
    });
    return false;
});

References

Alternate Usage

Final Thought

For those jQuery masters, please let me know if there are ways to improve this code. I am all open ears and hungry to learn :-)

For those who have questions or concerns, feel free to let me know! If you would like to use images or flash videos in the popups, please use the elegant plugin solutions since this code is only meant for a light weight inline popup.

Inline Modal Window w/ CSS and jQuery

0
Şub
03
2011

How to: Create a fancy image gallery with JQuery Javascript is a very good way to create fancy contents and enhance your website functionnality. In this article, let’s have a look to some interesting script dedicated to create stunning tooltips and galleries with the help of Javascript.

How to: Create a fancy image gallery with JQuery

Javascript is a very good way to create fancy contents and enhance your website functionnality. In this article, let’s have a look to some interesting script dedicated to create stunning tooltips and galleries with the help of Javascript.

Demos:

 

  1. Simple tooltip
  2. Image tooltip with preview
  3. Link tooltip with preview

Installation

Step 1

First, you have to include the JQuery library between the <head> and </head> tags of your html page:

<script type="text/javascript" src="jquery-latest.pack.js"></script>

Step 2

Once you inclued JQuery to your html file, you have to include the following functions. To do so, embed it within <script type=”text/javascript”> //the code here </script>, or even better, put it in a separate .js file.

this.screenshotPreview = function(){
        /* CONFIG */

                xOffset = 10;
                yOffset = 30;

                // these 2 variable determine popup's distance from the cursor
                // you might want to adjust to get the right result

        /* END CONFIG */
        $("a.screenshot").hover(function(e){
                this.t = this.title;
                this.title = "";
                var c = (this.t != "") ? "
" + this.t : "";
                $("body").append("<p id='screenshot'><img src='"+ this.rel +"' alt='url preview' />"+ c +"</p>");
                $("#screenshot")
                        .css("top",(e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px")
                        .fadeIn("fast");
    },
        function(){
                this.title = this.t;
                $("#screenshot").remove();
    });
        $("a.screenshot").mousemove(function(e){
                $("#screenshot")
                        .css("top",(e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px");
        });
};
this.imagePreview = function(){
        /* CONFIG */

                xOffset = 10;
                yOffset = 30;

                // these 2 variable determine popup's distance from the cursor
                // you might want to adjust to get the right result

        /* END CONFIG */
        $("a.preview").hover(function(e){
                this.t = this.title;
                this.title = "";
                var c = (this.t != "") ? "
" + this.t : "";
                $("body").append("<p id='preview'><img src='"+ this.href +"' alt='Image preview' />"+ c +"</p>");
                $("#preview")
                        .css("top",(e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px")
                        .fadeIn("fast");
    },
        function(){
                this.title = this.t;
                $("#preview").remove();
    });
        $("a.preview").mousemove(function(e){
                $("#preview")
                        .css("top",(e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px");
        });
};
this.tooltip = function(){
        /* CONFIG */
                xOffset = 10;
                yOffset = 20;
                // these 2 variable determine popup's distance from the cursor
                // you might want to adjust to get the right result
        /* END CONFIG */
        $("a.tooltip").hover(function(e){
                this.t = this.title;
                this.title = "";
                $("body").append("<p id='tooltip'>"+ this.t +"</p>");
                $("#tooltip")
                        .css("top",(e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px")
                        .fadeIn("fast");
    },
        function(){
                this.title = this.t;
                $("#tooltip").remove();
    });
        $("a.tooltip").mousemove(function(e){
                $("#tooltip")
                        .css("top",(e.pageY - xOffset) + "px")
                        .css("left",(e.pageX + yOffset) + "px");
        });
};

Step 3

Once you inclued the gallery functions, you have to activate it. Like for the functions, you can embed it on your html page or put it in a separate .js file.

$(document).ready(function(){
        tooltip();//active les tooltip simple
        imagePreview();//active les tooltip image preview
        screenshotPreview();//active les tooltip lien avec preview
});

Step 4

The gallery is now fully functionnal. Though, we had to use some css to style it.
Paste the following code in your css file:

#screenshot{
        position:absolute;
        border:1px solid #ccc;
        background:#333;
        padding:5px;
        display:none;
        color:#fff;
}

#preview{
        position:absolute;
        border:1px solid #ccc;
        background:#333;
        padding:5px;
        display:none;
        color:#fff;
}

#tooltip{
        position:absolute;
        border:1px solid #333;
        background:#f7f5d1;
        padding:2px 5px;
        color:#333;
        display:none;
}

Step 5

Your gallery is now ready to use. Here’s 3 ways to use it:

To create a classic, but cool tooltip on a link, you have to give the html element a tooltip class, as well as a title:

<a href="http://cssglobe.com" title="Web Standards Magazine">Roll over for tooltip</a>

To create an very fancy image preview, you have to add the preview class to your html element:

<a href="image.jpg" title="Great looking landscape">Roll over to preview</a>

To create an image preview with a link to the full size image, you have to add the screenshot class to your html element, and a rel attribute, containing the full size image url as a value:

<a href="http://www.cssglobe.com" rel="cssg_screenshot.jpg" title="Web Standards Magazine">
Css Globe</a>
0
Şub
02
2011

jQuery Cycle Plugin – Beginner Demos Define Your Markup and Styles

jQuery Cycle Plugin – Beginner Demos

1 – Define Your Markup and Styles

All of the examples on this page use the following markup and CSS:

<div class="pics"> 
    <img src="images/beach1.jpg" width="200" height="200" /> 
    <img src="images/beach2.jpg" width="200" height="200" /> 
    <img src="images/beach3.jpg" width="200" height="200" /> 
</div> 
.pics {  
    height:  232px;  
    width:   232px;  
    padding: 0;  
    margin:  0;  
} 
 
.pics img {  
    padding: 15px;  
    border:  1px solid #ccc;  
    background-color: #eee;  
    width:  200px; 
    height: 200px; 
    top:  0; 
    left: 0 
} 

2 – Choose an Effect

You can choose from any of the following named effects:

  • blindX
  • blindY
  • blindZ
  • cover
  • curtainX
  • curtainY
  • fade
  • fadeZoom
  • growX
  • growY
  • scrollUp
  • scrollDown
  • scrollLeft
  • scrollRight
  • scrollHorz
  • scrollVert
  • shuffle
  • slideX
  • slideY
  • toss
  • turnUp
  • turnDown
  • turnLeft
  • turnRight
  • uncover
  • wipe
  • zoom

You specify the effect name by either passing a string to the cycle method or by using an options object and setting the fx property to the name of the desired effect. 

$('#s1').cycle('fade');
$('#s2').cycle({ 
    fx: 'scrollDown' 
});

3 – Choose Speed and Timeout Values

Next you may want to choose speed and timeout values to control how fast and how often the slide transitions occur. The speed option defines the number of milliseconds it will take to transition from one slide to the next. The timeout option specifies how many milliseconds will elapse between the start of each transition.

$('#s3').cycle({ 
    fx:    'fade', 
    speed:  2500 
 });
$('#s4').cycle({ 
    fx:      'scrollDown', 
    speed:    300, 
    timeout:  2000 
});

4 – Choose Other Options

There are many other options to choose from. Two that you may find useful are pause and random. The pause option causes the slideshow to pause when the mouse hovers over the slide. The random option causes the slides to be shown in random order, rather than sequential.

$('#s5').cycle({ 
    fx:    'fade', 
    pause:  1 
});
$('#s6').cycle({ 
    fx:     'scrollDown', 
    random:  1 
});

Things to Keep in Mind

- CSS Rules! When building your slideshows, remember that animation effects work best when both the container and slide have a fixed box.

- Remember that every child element of the container becomes a slide!


1