html

jQuery Cycle Plugin – A Slideshow Creator Javascript File

Tuesday, February 16th, 2010

Here is another useful script that I wanted to write a quick post about. Its called jQuery Cycle Plugin, and its an additional javascript file that basically allows you to create a slideshow very easily and it supports many different types of transition effects. It ‘s dual licensed under the MIT and GPL licenses which is great so you can use it in basically any project. If you don’t want to use Flash this is a really simple way to setup a slideshow that will show in all browsers. Some of the transitions are: scrollup, scrollleft, scrollright, scrolldown, shuffle, and turndown. The images above is an example of it in action, and here is the code to it, really simple.

There are two things you need to add to your <head> section in your html, the css and javascript import lines:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<style type="text/css">
.banner {  
    height:  82px;  
    width:   82px;  
    padding: 0;  
    margin:  0;  
} 
 
.banner img {   
    border:  1px solid #fff;   
    width:  80px; 
    height: 80px; 
    top:  0; 
    left: 0 
} 
.banner img { display: none } //these lines hide all the rest of the pictures on startup 
.banner img.first { display: block } //except the first image
 
</style>
1
2
3
4
5
6
7
8
9
10
11
<!-- include jQuery library -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<!-- include Cycle plugin -->
<script type="text/javascript" src="http://cloud.github.com/downloads/malsup/cycle/jquery.cycle.all.2.72.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$('.banner').cycle({
			fx: 'scrollLeft' //  transition type, scrollleft
		});
	});
</script>

And here is the image code, just add this anywhere in your <body>, just make sure the class name is the same as what the javascript is looking for:

1
2
3
4
5
6
7
<div class="banner"> 
    <img src="http://scottrockers.com/blog/wp-content/uploads/2010/02/233158.jpg" width="80" height="80" /> 
    <img src="http://scottrockers.com/blog/wp-content/uploads/2010/02/271131.jpg" width="80" height="80" /> 
    <img src="http://scottrockers.com/blog/wp-content/uploads/2010/02/216505.jpg" width="80" height="80" /> 
    <img src="http://scottrockers.com/blog/wp-content/uploads/2010/02/260178.jpg" width="80" height="80" /> 
    <img src="http://scottrockers.com/blog/wp-content/uploads/2010/02/115908.jpg" width="80" height="80" /> 
</div>

jQuery: The Write Less, Do More Javascript Library

Friday, February 12th, 2010

Keeping up with the latest trends in web development is tough sometimes, only because there are new things always being created. jQuery is  one of the newer creations that have come up in the last several years and its not going away. It is the most popular JavaScript library in use today. If you don’t know what jQuery is then here is a brief description: jQuery is a JavaScript Library that is fast and concise that makes HTML document traversing, event handling, animating, and Ajax interactions for rapid web development much easier. “jQuery is designed to change the way that you write JavaScript.” It’s lightweight, around 23kb, and cross browser compliant and compliant with CSS3 as well. You can create sliding banners, dropdown navigations, and much more with it. I am trying to learn more and more of it everyday, and its pretty exciting. jQuery is provided under the MIT and GPL licenses which means you can use it in your commercial projects like selling of themes and stuff. There are several good tutorials and other helpful resources on their website and I would highly recommend it and learning some yourself.

Cya

Web Developer Toolbar Add-on for Firefox

Friday, February 5th, 2010

I wanted to take a second to talk about an awesome add-on for firefox: the Web Developer Toolbar. The Web Developer extension adds a menu and a toolbar to the browser with various web developer tools. It’s a must have for all developers and designers because it saves countless hours of developing and troubleshooting time, and it has tons of really great features. One of those great features is the ability to edit the CSS of a website in real time and see your changes updated on the web page as you type them. Then you can save out the changes you made and update accordingly. This alone can save you tons of time when  sifting through the files on your server searching for the correct CSS file to update, uploading  changes you made to it and then refreshing the browser to see the changes.  Another really nice feature is the one-click validating of your page’s HTML, CSS, and javascript. Instead of going to the W3C Markup Validation Website, and manually copying and pasting the urls into the field. It automatically does it for you, SO TIGHT!!!!! There are several other features of it that are really nice and if you are a designer or developer of websites I highly recommend it.

Cya