zoukankan      html  css  js  c++  java
  • 使用jQuery自动缩图片 (转载)

    具体思路:
    1. 通过具体容器取得容器内所有图片
    2. 循环检查所有图片长宽
    3. 对超过的图重新定高度.
    直接写成一个扩展好了,以后可以直接用.

    /* 自动缩略一些大图的小JS
        吕 lvjiyong@Gmail.com
        http://www.lvjiyong.com/tag/jquery/
        更新:2007.9.22
    */
    jQuery.fn.ImageAutoSize = function(width,height)
    {
        $("div.info_view img").each(function()
        {
            var image = $(this);
            if(image.width()>width)
            {
                image.width(width);
                image.height(width/image.width()*image.height());
            }
            if(image.height()>height)
            {
                image.height(height);
                image.width(height/image.height()*image.width());
            }
        });
    }

  • 相关阅读:
    MongoVUE 使用教程
    Mongo
    thinkPHP
    从关系型数据库到非关系型数据库
    boost 文件系统
    boost 随机数发生器
    CString/string 区别及其转化
    boost uuid
    使用命令行解析php文件
    Log4PHP日志库使用
  • 原文地址:https://www.cnblogs.com/luluping/p/1186705.html
Copyright © 2011-2022 走看看