<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>GLOBAL9 NETWORK &#187; IT TOOLS and UTILITY</title>
	<atom:link href="http://www.global9.net/category/it-tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.global9.net</link>
	<description>Freelancer WEB Hosting Provider</description>
	<lastBuildDate>Fri, 20 Jan 2012 20:15:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>jQuery Carousel</title>
		<link>http://www.global9.net/2009/06/jquery-carousel/</link>
		<comments>http://www.global9.net/2009/06/jquery-carousel/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 20:05:42 +0000</pubDate>
		<dc:creator>webmaster</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[IT TOOLS and UTILITY]]></category>
		<category><![CDATA[JQUERY]]></category>
		<category><![CDATA[TUTORIAL and HOW TO]]></category>
		<category><![CDATA[WEB PROGRAMMING]]></category>
		<category><![CDATA[carousel]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[learn]]></category>

		<guid isPermaLink="false">http://www.global9.net/?p=126</guid>
		<description><![CDATA[This tutorial will walk through the fundamentals of the effect and how to recreate it. Watch Sample Understanding the Effect As with any complicated effect, I always start by looking at the DOM in Firebug and interact with the effect, watching for what changes take effect in the DOM. Most importantly the list of images [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial will walk through the fundamentals of the effect and how to recreate it.</p>
<h2><em>Watch Sample <img src='http://www.global9.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></h2>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="311" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="flashvars" value="file=http%3A%2F%2Fjqueryfordesigners.com%2Fmedia%2Finfinite-carousel.flv&amp;plugins=viral-1d" /><param name="src" value="http://jqueryfordesigners.com/downloads/player-viral.swf" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="400" height="311" src="http://jqueryfordesigners.com/downloads/player-viral.swf" allowfullscreen="true" flashvars="file=http%3A%2F%2Fjqueryfordesigners.com%2Fmedia%2Finfinite-carousel.flv&amp;plugins=viral-1d"></embed></object></p>
<h2><em><strong>Understanding the Effect</strong></em></h2>
<p>As with any complicated effect, I always start by looking at the DOM in <a href="http://getfirebug.com/" target="_blank">Firebug </a>and interact with the effect, watching for what changes take effect in the DOM.</p>
<p>Most importantly the list of images (in a <span style="color: #ff0000;">&lt;ul&gt;</span> element) had additional <span style="color: #ff0000;">&lt;li&gt;</span> elements at the start of the list and at the end of the list. There were two types: clone and empty.</p>
<p>The second big clue was the number of cloned elements on the end of the list: it matched the number of visible items in the carousel.</p>
<p>In the diagram below I’ve tried to outline what’s cloned in the list, and show what’s visible. You can see how the list shows 3 items at once, but there’s 5 items in total. So the first cloned section (at the start of the list) contains two clones and a single empty clone. The end of the list has 3 clones &#8211; which represents real items 1-3:</p>
<p><img class="alignnone size-full wp-image-332" title="carousel" src="http://www.global9.net/wp-content/uploads/2009/06/carousel.png" alt="carousel" width="642" height="167" /></p>
<h2><em><strong>The Trick</strong></em></h2>
<p>Aside from building the DOM with the cloned nodes, the real trick is in the final panel of list items appearing. Because we’ve cloned the start of the list to the end of the list, when we scroll off the last items, it looks like we’ve looped back round. Once the animation completes, we change the scrollLeft position back to the real first items.</p>
<p>This scrollLeft isn’t visible to the user since the overflow is hidden, and so it creates the effect of being infinitely sliding from left or right (since it also works the other way around).</p>
<h2><em><strong>Markup</strong></em></h2>
<p>Remembering that we want the effect to work without JavaScript turned on, we’re going to use a pattern that we use fairly often for effects that <span style="color: #ff0000;">scroll: overflows</span>.</p>
<pre class="brush: xml; smart-tabs: true; tab-size: 4; title: ;">
&lt;div&gt;
   &lt;div&gt;
     &lt;ul&gt;
       &lt;li&gt;...&lt;/li&gt;
       &lt;li&gt;...&lt;/li&gt;
       &lt;li&gt;...&lt;/li&gt;
     &lt;/ul&gt;
   &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>The CSS has been marked up in a way that the overflow is visible to start off with, and that the individual <span style="color: #ff0000;">&lt;li&gt;</span> elements are the same fixed width. This is necessary to ensure that we always show complete images in the visible part of the carousel.</p>
<h2><strong>jQuery</strong> <strong></strong></h2>
<h2><em>Replicating the Effect</em></h2>
<p>This is a reasonably advanced effect so we need to plan carefully what we’re trying to achieve:</p>
<p>1. Markup that works without JavaScript (done!)<br />
2. Initialisation &amp; capture the height and width of the first carousel item (required for calculations)<br />
3. Create empty list items to pad to fill every page<br />
4. Generate cloned items on the start and end of the list<br />
5. Adjust the scroll left position to show the real first item<br />
6. Create goto method that supports forward and backwards<br />
7. Generate the next/prev links &amp; bind goto calls  The completed example is also available if you want to skip through each step.  Initialisation  We’re going to write the code as a plugin so we can release it out to the wild at some later point. So this follows the typical plugin pattern:</p>
<pre class="brush: jscript; smart-tabs: true; tab-size: 4; title: ;">
(function ($) {
   $.fn.myPlugin = function () {
      return this.each(function () {
        // plugin code
      };
   };
})
(jQuery);
</pre>
<p>This step is used to initialise the plugin and capture all the variables we need to create this effect. This includes:</p>
<p>1. jQuery instance of the overflow element<br />
2. Hiding the overflow<br />
3. jQuery instance of the list<br />
4. jQuery instance of the list items<br />
5. The first item and it’s width<br />
6. Number of visible items we can fit in the carousel (rounded up via Math.ceil)<br />
7. Current page (defaults to 1) and the number of pages (rounded up)</p>
<pre class="brush: jscript; smart-tabs: true; tab-size: 4; title: ;">
var $wrapper = $('&gt; div', this).css('overflow', 'hidden'),
   $slider = $wrapper.find('&gt; ul'),
   $items = $slider.find('&gt; li'),
   $single = $items.filter(':first'),

// outerWidth: width + padding (doesn't include margin)
   singleWidth = $single.outerWidth(),
// note: doesn't include padding or border
   visible = Math.ceil($wrapper.innerWidth() / singleWidth),
   currentPage = 1,
   pages = Math.ceil($items.length / visible);
</pre>
<h2><strong>Padding with Empty Items</strong></h2>
<p>During the screencast I said that we’re making use of the repeat function from another tutorial &#8211; however that was wrong! I must have used it for something else! None the less, here is the repeat function, which we put outside of the plugin since it’s a utility function:</p>
<pre class="brush: jscript; smart-tabs: true; tab-size: 4; title: ;">
function repeat(str, n) {
   return new Array( n + 1 ).join( str );
}
</pre>
<p>The repeat function simple uses and array hack to repeat any string n times.</p>
<p>When we create the empty padding, we need to use modulus to work out how many new empty items we need to fill every page of our carousel with an item:</p>
<pre class="brush: jscript; smart-tabs: true; tab-size: 4; title: ;">
if (($items.length % visible) != 0) {
   $slider.append(repeat('&lt;li /&gt;', visible - ($items.length % visible)));
   $items = $slider.find('&gt; li');
}
</pre>
<p>Notice that we reinitialise the <span style="color: #ff0000;">$items</span> variable. This is to ensure it contains all of the items, including our newly created empty items.</p>
<h2><strong>Generating Clones</strong></h2>
<p>As per the diagram in the introduction, we need to clone the last page of items to the start of the list, and the first page of items to the end of the list. These will be the items that we slide on to before we flip the <span style="color: #ff0000;">scrollLeft </span>position (as per the trick above).</p>
<pre class="brush: jscript; smart-tabs: true; tab-size: 4; title: ;">
  $items.filter(':first').before($items.slice(-visible).clone().addClass('cloned'));
  $items.filter(':last').after($items.slice(0, visible).clone().addClass('cloned'));
  $items = $slider.find('&gt; li'); // reselect
</pre>
<p>We’re making using the slice method that jQuery has. Notice that we first use it with a negative number:</p>
<pre class="brush: jscript; smart-tabs: true; tab-size: 4; title: ;">
  $items.slice(-visible)
</pre>
<p>This means to take the last n items off the end of <span style="color: #ff0000;">$items</span>. Otherwise we have to pass the start and end point, so the second instance we’re saying from the start, 0, and the third as the method is zero-based indices.</p>
<p><span style="color: #ff0000;">Reset Scroll Left</span></p>
<p>Since we’ve created the clones at the start of the list, we need to shift the <span style="color: #ff0000;">scroll </span><span style="color: #ff0000;">left </span>back to the real element, otherwise it would look like the carousel is sitting on the last page.</p>
<pre class="brush: jscript; smart-tabs: true; tab-size: 4; title: ;">
  $wrapper.scrollLeft(singleWidth * visible);
</pre>
<h2><strong>Go To Method</strong></h2>
<p>The <span style="color: #ff0000;">gotoPage </span>method will handle going forward and backwards and handle jumping several pages at a time.</p>
<p>We’re going to use the animate method and only <span style="color: #ff0000;">animate </span>the <span style="color: #ff0000;">scrollLeft </span>so that it smoothly scrolls. We could add custom easin if we wanted at a later date.</p>
<p>We need to establish the following:</p>
<p> 1. Direction we’re going to slide<br />
 2. Number of pages to slide<br />
 3. The relative scroll left value</p>
<p>Once the <span style="color: #ff0000;">animation </span>has completed, we also need to maintain the <span style="color: #ff0000;">currentPage </span>variable we created on initialisation.</p>
<p>If the page number is greater than the number of pages (i.e. we’re on our cloned first page), then reset the scroll left to the real first page, and set the page number to 1.</p>
<p>Equally if we have hit the beginning of the list (i.e. we’re showing the cloned last page), then we reset the scroll left to the real last page, and set the page number to the total number of pages.</p>
<pre class="brush: jscript; smart-tabs: true; tab-size: 4; title: ;">
function gotoPage(page) {
 var dir = page &lt; currentPage ? -1 : 1,
 n = Math.abs(currentPage - page),
 left = singleWidth * dir * visible * n;

 $wrapper.filter(':not(:animated)').animate({
 scrollLeft : '+=' + left
 }, 500, function () {
   if (page == 0) {
     $wrapper.scrollLeft(singleWidth * visible * pages);
     page = pages;
   } else if (page &gt; pages) {
     $wrapper.scrollLeft(singleWidth * visible);
     page = 1;
   } 

 currentPage = page;
 });                

 return false;
}
</pre>
<p>Navigation buttons</p>
<p>Finally we need to add the buttons or links to page through the carousel and bind the gotoPage call.</p>
<p>We’re also going to create a custom goto event that allows us to also jump to any page:</p>
<pre class="brush: jscript; smart-tabs: true; tab-size: 4; title: ;">
$wrapper.after('&lt;a class=&quot;arrow back&quot;&gt; &lt; &lt;/a&gt;&lt;a class=&quot;arrow forward&quot;&gt; &gt; &lt;/a&gt;');

$('a.back', this).click(function () {
 return gotoPage(currentPage - 1);
});

$('a.forward', this).click(function () {
 return gotoPage(currentPage + 1);
});

// this currently refers to the element the plugin was bound to
$(this).bind('goto', function (event, page) {
 gotoPage(page);
});
</pre>
<p>Demo Script Download <a class="downloadlink" href="http://www.global9.net/download/carousel.zip" title="Version14 jun 2009 downloaded 68 times" >Demo Carousel Static (68)</a> here <img src='http://www.global9.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h5>Re-Edit From : http://jqueryfordesigners.com</h5>
<h5>For another carousel please try this:  http://sorgalla.com/projects/jcarousel </h5>
]]></content:encoded>
			<wfw:commentRss>http://www.global9.net/2009/06/jquery-carousel/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Trace your code with FireBug</title>
		<link>http://www.global9.net/2009/01/trace-your-code-with-firebug/</link>
		<comments>http://www.global9.net/2009/01/trace-your-code-with-firebug/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 13:37:13 +0000</pubDate>
		<dc:creator>webmaster</dc:creator>
				<category><![CDATA[IT TOOLS and UTILITY]]></category>
		<category><![CDATA[TUTORIAL and HOW TO]]></category>
		<category><![CDATA[WEB PROGRAMMING]]></category>
		<category><![CDATA[addon]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[firebug]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[trace]]></category>
		<category><![CDATA[WEB AND DESIGN]]></category>

		<guid isPermaLink="false">http://www.global9.net/?p=107</guid>
		<description><![CDATA[Hai there, if you are a Web developer, designer who work on web sites, this tools is very good for you. this tools is very usefull for us on test and tweak your web script code.. Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You [...]]]></description>
			<content:encoded><![CDATA[<p>Hai there,</p>
<p>if you are a Web developer, designer who work on web sites, this tools is very good for you.</p>
<p>this tools is very usefull for us on test and tweak your web script code..</p>
<p>Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.</p>
<h3>Just the way you like it</h3>
<p>Firebug is always just a keystroke away, but it never gets in your way. You can open Firebug in a separate window, or as a bar at the bottom of your browser. Firebug also gives you fine-grained control over which websites you want to enable it for&#8230;</p>
<p><strong>F12 is your friend</strong></p>
<p>The F12 key is undoubtedly the fastest way to get to Firebug. Train yourself to hit that key when it&#8217;s time to go debugging. If you&#8217;re the big screen type, use Control+F12 (or Command+F12 on Mac) to open Firebug in a separate window.</p>
<p><br class="spacer_" /></p>
<h3>Inspect and edit HTML</h3>
<p><img class="alignleft size-medium wp-image-111" style="border: 0pt none; float: left; margin-left: 3px; margin-right: 3px;" title="screenhome-html" src="http://www.global9.net/wp-content/uploads/2009/01/screenhome-html.gif" alt="" width="164" height="144" />Firebug makes it simple to find HTML elements buried deep in the page. Once you&#8217;ve found what you&#8217;re looking for, Firebug gives you a wealth of information, and lets you edit the HTML live.</p>
<h3>View source live</h3>
<p>Firefox has a &#8220;View Source&#8221; window, but it doesn&#8217;t show you what the HTML source really looks like once it has been transformed by JavaScript. Firebug&#8217;s HTML tab shows you what the HTML looks like <strong>right now</strong>.</p>
<p>In addition, the tabs on the right side let you discover the properties of an individual element, including the CSS rules that are styling it, the pixels that define its position and size, and the DOM properties that you can access from JavaScript.</p>
<h3>See changes highlighted</h3>
<p><img class="alignright size-medium wp-image-113" style="border: 0pt none; float: right; margin-left: 3px; margin-right: 3px;" title="screenhtml-highlight" src="http://www.global9.net/wp-content/uploads/2009/01/screenhtml-highlight.gif" alt="" width="214" height="164" />In any JavaScript-driven website, HTML elements are constantly being created, removed, and modified. Wouldn&#8217;t it be nice if you could see exactly what, when, and where these changes take place?</p>
<p>Firebug highlights changes to the HTML in yellow immediately when they occur. If you want to spy even closer, you have the option to also scroll every change into view, so you won&#8217;t miss a thing.</p>
<h3>Find elements with the mouse</h3>
<p><a href="http://www.global9.net/wp-content/uploads/2009/01/firebuginspect.jpg" rel="lightbox[107]"><img class="alignnone size-thumbnail wp-image-116" style="border: 0pt none; margin-left: 3px; margin-right: 3px; float: left;" title="firebuginspect" src="http://www.global9.net/wp-content/uploads/2009/01/firebuginspect-150x150.jpg" alt="" width="150" height="150" /></a>Something in your page doesn&#8217;t quite look right and you want to know why. There&#8217;s no faster way to get answers than to click the &#8220;Inspect&#8221; button on Firebug&#8217;s toolbar and then prepare for immediate gratification. As you move around the page, whatever is beneath your mouse will be instantly revealed within Firebug, showing you the HTML and CSS behind it.</p>
<h3>Monitor network activity</h3>
<p><img class="alignright size-medium wp-image-118" style="border: 0pt none; float: right; margin-left: 3px; margin-right: 3px;" title="screenhome-net" src="http://www.global9.net/wp-content/uploads/2009/01/screenhome-net.gif" alt="" width="164" height="144" />Your pages are taking a long time to load, but why? Did you go crazy and write too much JavaScript? Did you forget to compress your images? Are your ad partner&#8217;s servers taking a siesta? Firebug breaks it all down for you file-by-file.</p>
<h3>Debug and profile JavaScript</h3>
<p>Firebug includes a powerful JavaScript debugger that lets you pause execution at any time and have look at the state of the world. If your code is a little sluggish, use the JavaScript profiler to measure performance and find bottlenecks fast.</p>
<h3>Quickly find errors</h3>
<p>When things go wrong, Firebug lets you know immediately and gives you detailed and useful information about errors in JavaScript, CSS, and XML.</p>
<h3>Explore the DOM</h3>
<p>The Document Object Model is a great big hierarchy of objects and functions just waiting to be tickled by JavaScript. Firebug helps you find DOM objects quickly and then edit them on the fly.</p>
<p><a href="https://addons.mozilla.org/firefox/addon/1843" target="_blank"><img class="alignnone size-full wp-image-120" style="border: 0pt none;" title="install1_2" src="http://www.global9.net/wp-content/uploads/2009/01/install1_2.png" alt="" width="144" height="116" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.global9.net/2009/01/trace-your-code-with-firebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

