<?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>NeatCN(NeatStudio工作室) &#187; plugin</title>
	<atom:link href="http://www.neatcn.com/tags/plugin/feed" rel="self" type="application/rss+xml" />
	<link>http://www.neatcn.com</link>
	<description>NeatStudio工作室</description>
	<lastBuildDate>Fri, 09 Dec 2011 13:07:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>jQuery图片自动缩放</title>
		<link>http://www.neatcn.com/show-37-1.shtml</link>
		<comments>http://www.neatcn.com/show-37-1.shtml#comments</comments>
		<pubDate>Sun, 28 Mar 2010 13:08:50 +0000</pubDate>
		<dc:creator>膘叔</dc:creator>
				<category><![CDATA[Javascript开发]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.neatcn.com/?p=37</guid>
		<description><![CDATA[半年前写的代码，现在看看也不算太差就放上来了 $(document).ready(function(){ $('div').autoResize({height:50}); //用法 }); jQuery.fn.autoResize = function(options) { var opts = { 'width' : 400, 'height': 300 } var opt = $.extend(true, {},opts,options &#124;&#124; {}); width = opt.width; height = opt.height; $('img',this).each(function(){ var image = new Image(); image.src = &#8230; <a href="http://www.neatcn.com/show-37-1.shtml">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>半年前写的代码，现在看看也不算太差就放上来了</p>
<pre class="brush:javascript">
$(document).ready(function(){
    $('div').autoResize({height:50});  //用法
});  

jQuery.fn.autoResize = function(options)
{
    var opts = {
        'width' : 400,
        'height': 300
    }
    var opt = $.extend(true, {},opts,options || {});
    width = opt.width;
    height = opt.height;
    $('img',this).each(function(){
        var image = new Image();
        image.src = $(this).attr('src');
        //开始检查图片
        if(image.width > 0 &#038;&#038; image.height > 0 ){
            var image_rate = 1;
            if( (width / image.width) < (height / image.height)){
                image_rate = width / image.width ;
            }else{
                image_rate = height / image.height ;
            }
            if ( image_rate <= 1){
                $(this).width(image.width * image_rate);
                $(this).height(image.height * image_rate);
            }
        }
    });
}
</pre>
<p>用法也写在上面了。可以直接使用。。。</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.neatcn.com/show-37-1.shtml/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

