<?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>A Beautiful Blog &#187; jQuery</title>
	<atom:link href="http://www.abeautifulsite.net/blog/category/javascript/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.abeautifulsite.net/blog</link>
	<description></description>
	<lastBuildDate>Fri, 03 Feb 2012 02:48:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>jQuery SelectBox&#160;Plugin</title>
		<link>http://www.abeautifulsite.net/blog/2011/01/jquery-selectbox-plugin/</link>
		<comments>http://www.abeautifulsite.net/blog/2011/01/jquery-selectbox-plugin/#comments</comments>
		<pubDate>Mon, 24 Jan 2011 22:40:53 +0000</pubDate>
		<dc:creator>Cory LaViska</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://abeautifulsite.net/blog/?p=1253</guid>
		<description><![CDATA[While it is possible to use CSS to style SELECT elements, browser support and appearance will vary greatly depending on platform and browser.  In our search for a solid, customizable replacement for these finicky controls, we turned up only a &#8230; <a class="more-link" href="http://www.abeautifulsite.net/blog/2011/01/jquery-selectbox-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>While it is possible to use CSS to style SELECT elements, browser support and appearance will vary greatly depending on platform and browser.  In our search for a solid, customizable replacement for these finicky controls, we turned up only a handful of possible options that we ultimately weren&#8217;t thrilled with for one reason or another. Thus, today we&#8217;re introducing a new jQuery plugin that replaces standard SELECT elements so you can customize them entirely using CSS.  We even threw in some extra features for added usability.<span id="more-1253"></span></p>
<p><img class="aligncenter size-full wp-image-1302" title="Select Box Screenshot" src="http://abeautifulsite.net/blog/wp-content/uploads/2011/01/selectBox.png" alt="Select Box Screenshot" width="535" height="260" /></p>
<p>The plugin works by piggy-backing your existing SELECT controls.  Since the original controls aren&#8217;t destroyed (they&#8217;re hidden), you can easily integrate this plugin into just about any existing form. The plugin degrades gracefully, as users without JavaScript will see the default SELECT controls.</p>
<h2>Plugin Features</h2>
<ul>
<li>Easily replace existing SELECT controls</li>
<li>Supports OPTGROUPs</li>
<li>Supports standard dropdown controls</li>
<li>Supports multi-select controls (i.e. multiple=&#8221;multiple&#8221;)</li>
<li>Supports inline controls (i.e. size=&#8221;5&#8243;)</li>
<li>Fully accessible via keyboard</li>
<li>Shift + click (or shift + enter) to select a range of options in multi-select controls</li>
<li>Type to search when the control has focus</li>
<li>Auto-height based on the size attribute (to use, omit the height property in your CSS!)</li>
<li>Tested in IE7-9, Firefox 3-4, recent webkit browsers, and Opera.</li>
</ul>
<p>Please refer to the main source file for implementation examples, a list of known issues, and the change log.</p>
<h2>Demo &amp; Download</h2>
<p>This project is actively maintained on GitHub.  Please submit all issues and contributions to the project page.  Licensed under both the MIT and the GNU GPL licenses.</p>
<p><a href="http://labs.abeautifulsite.net/jquery-selectBox/">Demo Page</a> | <a href="https://github.com/claviska/jquery-selectBox">Download the latest version on GitHub</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.abeautifulsite.net/blog/2011/01/jquery-selectbox-plugin/feed/</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
		<item>
		<title>Smoothly Scroll to an Element Without a jQuery&#160;Plugin</title>
		<link>http://www.abeautifulsite.net/blog/2010/01/smoothly-scroll-to-an-element-without-a-jquery-plugin/</link>
		<comments>http://www.abeautifulsite.net/blog/2010/01/smoothly-scroll-to-an-element-without-a-jquery-plugin/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 03:00:58 +0000</pubDate>
		<dc:creator>Cory LaViska</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://abeautifulsite.net/?p=718</guid>
		<description><![CDATA[After spending some time looking for a plugin to do this, I was amazed to see how easy it was to get a smooth scrolling effect using one line of jQuery.  You can use this inside of any callback function.  &#8230; <a class="more-link" href="http://www.abeautifulsite.net/blog/2010/01/smoothly-scroll-to-an-element-without-a-jquery-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After spending some time looking for a plugin to do this, I was amazed to see how easy it was to get a smooth scrolling effect using one line of jQuery.  You can use this inside of any callback function.  It works especially well with <strong>click</strong>.<span id="more-718"></span></p>
<pre class="brush: jscript; title: ; notranslate">
$('html, body').animate({
	scrollTop: $(&quot;#elementID&quot;).offset().top
}, 2000);
</pre>
<p>Although <a href="http://flesler.blogspot.com/2007/10/jquerylocalscroll-10.html">LocalScroll</a> is good for more advanced applications, this snippet is useful for one-time use applications.  Simply adjust <strong>#elementID</strong> and <strong>2000</strong> to set the element and duration, respectively.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abeautifulsite.net/blog/2010/01/smoothly-scroll-to-an-element-without-a-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Word-wrap&#160;Plugin</title>
		<link>http://www.abeautifulsite.net/blog/2009/12/jquery-word-wrap-plugin/</link>
		<comments>http://www.abeautifulsite.net/blog/2009/12/jquery-word-wrap-plugin/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 02:26:13 +0000</pubDate>
		<dc:creator>Cory LaViska</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://abeautifulsite.net/?p=692</guid>
		<description><![CDATA[The Problem When it comes to textareas, the concept of word-wrapping is not as easy as it should be. In most browsers, including Firefox, Safari, Chrome, and Opera, you can set the textarea&#8217;s wrap attribute to on or off to &#8230; <a class="more-link" href="http://www.abeautifulsite.net/blog/2009/12/jquery-word-wrap-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h1>The Problem</h1>
<p>When it comes to textareas, the concept of word-wrapping is not as easy as it should be. In most browsers, including Firefox, Safari, Chrome, and Opera, you can set the textarea&#8217;s <strong>wrap</strong> attribute to <strong>on</strong> or <strong>off</strong> to achieve your preference.  Internet Explorer, on the other hand, requires a <a href="http://msdn.microsoft.com/en-us/library/ms535152%28VS.85%29.aspx">special value for the <strong>wrap</strong> attribute</a>.<span id="more-692"></span></p>
<p>&nbsp;</p>
<p><img class="aligncenter size-full wp-image-1348" title="word-wrap" src="http://abeautifulsite.net/blog/wp-content/uploads/2009/12/word-wrap.png" alt="" width="418" height="149" />Although it should be simple enough to check for the browser type and toggle the appropriate value for <strong>wrap</strong> on-the-fly, there&#8217;s one more problem.  Because it&#8217;s not technically a valid attribute, most browsers (other than IE) won&#8217;t respond to changes to the <strong>wrap</strong> attribute that occur via JavaScript.  This means that if you want to have a checkbox next to your textarea that enables and disables word-wrapping dynamically, you&#8217;re out of luck.</p>
<h1>The Solution</h1>
<p>To work around this problem, we need to first check for the browser type and go from there:</p>
<ol>
<li>If IE, update the <strong>wrap</strong> attribute to be either <strong>soft</strong> or <strong>off</strong></li>
<li>If not IE, clone the textarea, set the appropriate <strong>wrap</strong> attribute, and update the DOM</li>
</ol>
<p>Here is a really simple jQuery plugin that I&#8217;ve created to do just that.</p>
<h2>The jQuery Word-wrap Plugin</h2>
<p>The plugin is really easy to use.  Just make sure to include jQuery and the plugin in your page:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;jquery.wordWrap.js&quot;&gt;&lt;/script&gt;
</pre>
<p>To enable and disable word-wrapping on-the-fly, simply call the <strong>wordWrap()</strong> method at any time:</p>
<pre class="brush: jscript; title: ; notranslate">
$(document).ready( function() {

	// Enable word-wrapping
	$(&quot;TEXTAREA&quot;).wordWrap('on');

	// Disable word-wrapping
	$(&quot;TEXTAREA&quot;).wordWrap('off');

});
</pre>
<p>You can use any standard jQuery selector.  <strong> </strong>Note that browsers have word-wrapping enabled by default for textarea elements.</p>
<h2>Demo</h2>
<p>View a <a href="http://labs.abeautifulsite.net/archived/jquery-wordWrap/demo/">working demo</a> of this plugin.</p>
<h2>Download</h2>
<p><a href="http://labs.abeautifulsite.net/archived/jquery-wordWrap/jquery.wordWrap.zip">Version 1.0</a></p>
<p>This plugin is provided to you as-is, at absolutely no cost. If you would like to support its development, feel free to contribute any amount you prefer via PayPal. As always, you are welcome to contribute code for bug fixes and feature enhancements as well. Either way, thanks for supporting our efforts!</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="1289517" />
<input type="image" name="submit" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" /> <img src="https://www.paypal.com/en_US/i/scr/pixel.gif" alt="" /></form>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<h2 id="licensing">Licensing &amp; Terms of Use</h2>
<p>This plugin is dual-licensed under the <a href="http://www.opensource.org/licenses/gpl-3.0.html" rel="external">GNU General Public License</a> and the <a href="http://www.opensource.org/licenses/mit-license.php" rel="external">MIT License</a> and is copyright A Beautiful Site, LLC.</p>
</form>
]]></content:encoded>
			<wfw:commentRss>http://www.abeautifulsite.net/blog/2009/12/jquery-word-wrap-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery UI Star Rating&#160;Widget</title>
		<link>http://www.abeautifulsite.net/blog/2009/11/jquery-ui-star-rating-widget/</link>
		<comments>http://www.abeautifulsite.net/blog/2009/11/jquery-ui-star-rating-widget/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 01:41:22 +0000</pubDate>
		<dc:creator>Cory LaViska</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://abeautifulsite.net/?p=510</guid>
		<description><![CDATA[A friend of mine needed a good rating script for a project he&#8217;s working on. When he linked me to this star rating widget, I didn&#8217;t have very high expectations, but after seeing the widget and its implementation I&#8217;m actually &#8230; <a class="more-link" href="http://www.abeautifulsite.net/blog/2009/11/jquery-ui-star-rating-widget/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A friend of mine needed a good rating script for a project he&#8217;s working on.  When he linked me to this <a href="http://orkans-tmp.22web.net/star_rating/">star rating widget</a>, I didn&#8217;t have very high expectations, but after seeing the widget and its implementation I&#8217;m actually quite impressed.  (The only drawback is that it requires jQuery UI and can&#8217;t be implemented as a stand-alone plugin.)<span id="more-510"></span></p>
<p>One thing that makes jQuery plugins truly awesome is their ability to be completely unobtrusive (read: &#8220;degrade gracefully&#8221;).  In this case, the Star Rating widget makes use of either a group of radio controls or a dropdown menu which get replaced before the page loads.  When you submit the form, the values are carried over just as you would normally expect.  Simple.</p>
<p>Of course, the plugin sports all the features you could possible want for a simple rating widget.  If you&#8217;ve been looking for a jQuery UI-based rating widget, you&#8217;ll be more than happy with this one.  It would be nice, however, to have a version of this plugin that doesn&#8217;t have the jQuery UI dependency.  I&#8217;ve got nothing against jQuery UI, but it&#8217;s rather heavy if all you&#8217;re using it for is a simple rating widget.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abeautifulsite.net/blog/2009/11/jquery-ui-star-rating-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery $.live(&#8216;click&#8217;) Binds Both the Left and Right Mouse&#160;Buttons</title>
		<link>http://www.abeautifulsite.net/blog/2009/05/jquery-live-click-binds-both-the-left-and-right-mouse-buttons/</link>
		<comments>http://www.abeautifulsite.net/blog/2009/05/jquery-live-click-binds-both-the-left-and-right-mouse-buttons/#comments</comments>
		<pubDate>Thu, 14 May 2009 22:57:52 +0000</pubDate>
		<dc:creator>Cory LaViska</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://abs.lavitech.com/?p=99</guid>
		<description><![CDATA[A little jQuery $.live('click') gotcha and an easy work around for it. <a class="more-link" href="http://www.abeautifulsite.net/blog/2009/05/jquery-live-click-binds-both-the-left-and-right-mouse-buttons/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>Update: <a href="http://dev.jquery.com/ticket/3861">This issue has been fixed</a> as of jQuery 1.4.1.</strong> I would recommend upgrading if possible.  That said, the solution below still applies to jQuery 1.4 and below.</p>
<p>Here&#8217;s a little gotcha that I uncovered while working with jQuery&#8217;s <samp>$.live()</samp> handler. In short, <samp>$.live(&#8216;click&#8217;)</samp> will detect both left and right mouse clicks (and probably middle clicks, as well). In other words, if you&#8217;re expecting to only fire an event on a left click, you&#8217;ll have to test for it and, unfortunately, Internet Explorer likes to behave differently here.<span id="more-99"></span></p>
<p>So, for all non-IE browsers you can do this:</p>
<pre class="brush: jscript; title: ; notranslate">
$(&quot;#element&quot;).live('click', function(e) {
    if( e.button == 0 ) {
        // Left mouse button was clicked (non-IE)
    }
});
</pre>
<p>But for IE, you need to do this:</p>
<pre class="brush: jscript; title: ; notranslate">
$(&quot;#element&quot;).live('click', function(e) {
    if( e.button == 1 ) {
        // Left mouse button was clicked (IE only)
    }
});
</pre>
<p>So let&#8217;s make it easier on everyone.  Although I hate browser checks, I don&#8217;t really know of a way around this without one.  (I also realize that <samp>$.browser</samp> has been deprecated — although still included — in jQuery 1.3.)</p>
<pre class="brush: jscript; title: ; notranslate">
$(&quot;#element&quot;).live('click', function(e) {
    if( (!$.browser.msie &amp;&amp; e.button == 0) || ($.browser.msie &amp;&amp; e.button == 1) ) {
        // Left mouse button was clicked (all browsers)
    }
});
</pre>
<p class="note">Make sure you include the <samp>e</samp> argument in your anonymous function, otherwise <samp>e</samp> will be undefined.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abeautifulsite.net/blog/2009/05/jquery-live-click-binds-both-the-left-and-right-mouse-buttons/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Jcrop: Cropping Images with&#160;jQuery</title>
		<link>http://www.abeautifulsite.net/blog/2009/03/jcrop-cropping-images-with-jquery/</link>
		<comments>http://www.abeautifulsite.net/blog/2009/03/jcrop-cropping-images-with-jquery/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 01:16:47 +0000</pubDate>
		<dc:creator>Cory LaViska</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://abs.lavitech.com/?p=95</guid>
		<description><![CDATA[An excellent jQuery plugin for cropping images on the Web. <a class="more-link" href="http://www.abeautifulsite.net/blog/2009/03/jcrop-cropping-images-with-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p> <a href="http://deepliquid.com/content/Jcrop.html" rel="external">Jcrop</a> is without a doubt the best jQuery plugin for adding image cropping functionality to your web apps.  Here is a brief list of features: </p>
<ul>
<li>Aspect ratio locking</li>
<li>Adjustable min/max size</li>
<li>Useful callbacks</li>
<li>Keyboard support</li>
<li>Animated selection line (similar to Photoshop)</li>
</ul>
<p> Jcrop works in all popular browsers.  You can see the plugin in action on Deep Liquid&#8217;s <a href="http://deepliquid.com/projects/Jcrop/demos.php" rel="external">Jcrop demo page</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.abeautifulsite.net/blog/2009/03/jcrop-cropping-images-with-jquery/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>jQuery File Upload&#160;Plugin</title>
		<link>http://www.abeautifulsite.net/blog/2009/02/jquery-file-upload-plugin/</link>
		<comments>http://www.abeautifulsite.net/blog/2009/02/jquery-file-upload-plugin/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 21:03:42 +0000</pubDate>
		<dc:creator>Cory LaViska</dc:creator>
				<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://abs.lavitech.com/?p=91</guid>
		<description><![CDATA[Ronnie San releases a great file upload plugin for jQuery. <a class="more-link" href="http://www.abeautifulsite.net/blog/2009/02/jquery-file-upload-plugin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p> I found a great <a href="http://www.ronniesan.com/articles/jquery-multiple-file-upload.php" rel="external">File Upload plugin</a> for jQuery.  It uses JavaScript + Flash to support multiple uploads and progress reporting (similar to YUI and other multiple file uploaders).  From the plugin&#8217;s author: </p>
<blockquote><p> 	This plugin allows you to change any element with an ID on your page into a single or multiple 	file upload tool.  The plugin uses a mix of JQuery, Flash, and a backend upload script of your 	choice to send files from your local computer to your website server. </p></blockquote>
<p> My preliminary review has yielded excellent results, and this is much easier to implement than the <a href="http://developer.yahoo.com/yui/uploader/" rel="external">YUI Uploader</a>, <a href="http://swfupload.org/" rel="external">SWFUPload</a>, and some others I&#8217;ve worked with. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.abeautifulsite.net/blog/2009/02/jquery-file-upload-plugin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using jQuery with&#160;Greasemonkey</title>
		<link>http://www.abeautifulsite.net/blog/2009/01/using-jquery-with-greasemonkey/</link>
		<comments>http://www.abeautifulsite.net/blog/2009/01/using-jquery-with-greasemonkey/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 17:43:25 +0000</pubDate>
		<dc:creator>Cory LaViska</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://abs.lavitech.com/?p=90</guid>
		<description><![CDATA[A snippet that allows you to use jQuery with your Greasemonkey scripts. <a class="more-link" href="http://www.abeautifulsite.net/blog/2009/01/using-jquery-with-greasemonkey/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a great method to get <a rel="external" href="http://jquery.com/">jQuery</a> working with your     <a rel="external" href="https://addons.mozilla.org/en-US/firefox/addon/748">Greasemonkey</a> scripts.     This method was inspired by Joan Piedra&#8217;s <a rel="external" href="http://joanpiedra.com/jquery/greasemonkey/">jQuery &amp; Greasemonkey snippet</a>:</p>
<p><span id="more-90"></span></p>
<pre class="brush: jscript; title: ; notranslate">
GM_jQuery.src = 'http://jqueryjs.googlecode.com/files/jquery-1.2.6.pack.js';
GM_jQuery.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(GM_jQuery);

// Wait until jQuery has loaded
function GM_wait() {
    if( typeof unsafeWindow.jQuery == 'undefined' ) {
        window.setTimeout(GM_wait,100);
    } else {
        $ = unsafeWindow.jQuery;
        GM_ready();
    }
}
GM_wait();

// Once document and jQuery are loaded
function GM_ready() {
    //
    // [Your Greasemonkey code here]
    //
}
</pre>
<p class="note">You can avoid occassional page load lags by changing the link to jQuery to one on your own server.  Note that     you won&#8217;t need to use this code if jQuery is already being used on the corresponding website.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abeautifulsite.net/blog/2009/01/using-jquery-with-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Manipulating Stylesheets with&#160;Greasemonkey</title>
		<link>http://www.abeautifulsite.net/blog/2009/01/manipulating-stylesheets-with-greasemonkey/</link>
		<comments>http://www.abeautifulsite.net/blog/2009/01/manipulating-stylesheets-with-greasemonkey/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 17:17:57 +0000</pubDate>
		<dc:creator>Cory LaViska</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://abs.lavitech.com/?p=89</guid>
		<description><![CDATA[A set of useful snippets to work with styles in Greasemonkey. <a class="more-link" href="http://www.abeautifulsite.net/blog/2009/01/manipulating-stylesheets-with-greasemonkey/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>These are pretty useful snippets for working with stylesheets in 	<a rel="external" href="https://addons.mozilla.org/en-US/firefox/addon/748">Greasemonkey</a>, 	but they can be used elsewhere, as well.<span id="more-89"></span></p>
<h2>Remove All Stylesheets From a Webpage</h2>
<p>This snippet can be used to remove all stylesheets that are <samp>&lt;link&gt;</samp>ed to the webpage. 	This will not work for <samp>&lt;style&gt;</samp>s and inline styles:</p>
<pre class="brush: jscript; title: ; notranslate">
for( i = 0; (l = document.getElementsByTagName(&quot;link&quot;)[i]); i++ ) {
    if( l.getAttribute(&quot;rel&quot;).indexOf(&quot;style&quot;) &gt;= 0 ) l.disabled = true;
}
</pre>
<h2>Linking to an External Stylesheet</h2>
<p>This lets you append a stylesheet to the page, effectively letting you override all 	of the other stylesheets on the page:</p>
<pre class="brush: jscript; title: ; notranslate">
var link = window.document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'http://example.com/styles/stylesheet.css';
document.getElementsByTagName(&quot;HEAD&quot;)[0].appendChild(link);
</pre>
<h2>Overriding Styles Without a Stylesheet</h2>
<p>This is the same concept as above, except you can use the <samp>data:</samp> protocol 	to specify your styles in the <samp>href</samp> attribute:</p>
<pre class="brush: jscript; title: ; notranslate">
var link = window.document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = 'data:text/css,' +
            // Selectors start here
            '#sidebar { background: #DDD; border: solid 1px #CCC; }' +
            'P { line-height: 1.5; }';
document.getElementsByTagName(&quot;HEAD&quot;)[0].appendChild(link);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.abeautifulsite.net/blog/2009/01/manipulating-stylesheets-with-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prevent White Noise From Appearing in Images After&#160;Fading</title>
		<link>http://www.abeautifulsite.net/blog/2009/01/prevent-white-noise-from-appearing-in-images-after-fading/</link>
		<comments>http://www.abeautifulsite.net/blog/2009/01/prevent-white-noise-from-appearing-in-images-after-fading/#comments</comments>
		<pubDate>Sat, 10 Jan 2009 20:16:21 +0000</pubDate>
		<dc:creator>Cory LaViska</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://abs.lavitech.com/?p=88</guid>
		<description><![CDATA[A bug in Internet Explorer causes white space to appear in certain images after fading. <a class="more-link" href="http://www.abeautifulsite.net/blog/2009/01/prevent-white-noise-from-appearing-in-images-after-fading/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The first time I ever saw this alleged bug was in Internet Explorer 7 yesterday.  Images were 	rotating on a page in the form of a slideshow, fading in and out for a nice, smooth transition. 	One problem, though: in Internet Explorer 7 (and 6, as it turned out), one of the images would 	appear with a small cluster of white pixels around the black areas. <span id="more-88"></span></p>
<p>To make sure the image wasn&#8217;t corrupt, I saved it again using PhotoShop.  No luck.  Even after 	saving the image as a GIF instead of a JPEG, the white noise persisted in IE.</p>
<p>Luckily, some research resulted in finding <a rel="external" href="http://www.alexjudd.com/?p=5">Alex Judd&#8217;s post</a>, 	which provided a relatively simple solution to the problem.</p>
<p>To summarize, the white noise occurs in both IE6 and IE7 on some (but not all) images when 	they fade in or out.  This is especially true when you&#8217;re using a JavaScript library such as 	<a rel="external" href="http://jquery.com/">jQuery</a> or <a rel="external" href="http://script.aculo.us/">script.aculo.us</a>.</p>
<p>Evidently, IE mistakes some of the true-black pixels for transparent pixels, which causes the 	&#8220;white&#8221; noise (which may not necessarily be white, depending on the underlying background).  One 	work around, as Alex points out, is to adjust the levels of the image in Photoshop very slightly—just 	enough to eliminate the true-black pixels.</p>
<p>To do this, open the image up in PhotoShop and perform the following steps:</p>
<ol>
<li>Select <samp>Image</samp>, <samp>Adjustments</samp>, <samp>Levels</samp></li>
<li>Move the <samp>Output Levels</samp> slider a few pixels to the right (or type in a small number, like 5)</li>
<li>Save the image</li>
</ol>
<p>In most cases, there won&#8217;t be a noticeable difference in color.  Alas, this work around does solve the 	display problem in IE, but not without tampering with the original image.  We&#8217;ll have to keep our fingers 	crossed in that IE8 finally addresses this issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.abeautifulsite.net/blog/2009/01/prevent-white-noise-from-appearing-in-images-after-fading/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

