<del id="d4fwx"><form id="d4fwx"></form></del>
      <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

            <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
          • 縮略圖jquery,縮略圖英文

            jquery 網(wǎng)頁鏈接的縮略圖怎么生成

            jqthumb是一款實用的響應式按比例生成圖片縮略圖的jQuery插件。

            成都創(chuàng)新互聯(lián)公司是一家專注于成都網(wǎng)站建設、網(wǎng)站制作與策劃設計,寶塔網(wǎng)站建設哪家好?成都創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設十多年,網(wǎng)設計領(lǐng)域的專業(yè)建站公司;建站業(yè)務涵蓋:寶塔等地區(qū)。寶塔做網(wǎng)站價格咨詢:18980820575

            jqthumb可以按照用戶設定的比例、尺寸、位置等屬性來生成新的縮略圖,在老的瀏覽器中它還能夠替代background-size屬性。

            jqthumb兼容性超強,可以工作在所有現(xiàn)代瀏覽器甚至是IE6+上,jQuery

            1.3以上版本即可運行。它還可以在Zepto(通過zepto-data插件)v1.1.3+上運行。

            這個jquery插件可以幫助我們按比例生成圖片縮略圖。大家可能知道在處理縮略圖的時候使用 background-size: cover; 可以解決許多棘手問題。但是 background-size: cover; 在IE6、IE7和IE8下不能正常工作。而該插件正是彌補了這個缺陷。

            使用方法

            使用以下的簡單html結(jié)構(gòu):

            div style="width: 100%; height: 400px;"

            img src="path/picture.jpg" class="example1" /

            /div

            div style="width: 400px; height: 400px;"

            img src="path/picture.jpg" class="example2" /

            /div

            button id="kill"Kill/button

            button id="kill-all"Kill All/button

            在頁面中引入jQuery和jqthumb.min.js文件:

            script type="text/javascript" src="scripts/jquery.min.js"/script

            script type="text/javascript" src="scripts/jqthumb.min.js"/script

            然后按下面方法調(diào)用插件:

            script type="text/javascript"

            $(function(){

            // plugin initialization

            $('img').jqthumb({

            classname : 'jqthumb', // class name. DEFUALT IS jqthumb

            width : '100%', // new image width after cropping. DEFAULT IS 100px.

            height : '100%', // new image height after cropping. DEFAULT IS 100px.

            position : {

            x : '50%', // x position of the image. DEFAULT is 50%. 50% also means centerize the image.

            y : '50%' // y position of the image. DEFAULT is 50%. 50% also means centerize the image.

            },

            source : 'src', // to specify the image source attribute. DEFAULT IS src.

            show : false, // TRUE = show immediately after processing. FALSE = do not show it. DEFAULT IS TRUE.

            responsive : 20, // used by older browsers only. 0 to disable. DEFAULT IS 20

            zoom : 1, // zoom the output, 2 would double of the actual image size. DEFAULT IS 1

            method : 'auto', // 3 methods available: "auto", "modern" and "native". DEFAULT IS auto

            before : function(oriImage){ // callback before each image starts processing.

            alert("I'm about to start processing now...");

            },

            after : function(imgObj){ // callback when each image is cropped.

            console.log(imgObj);

            },

            done : function(imgArray){ // callback when all images are cropped.

            for(i in imgArray){

            $(imgArray[i]).fadeIn();

            }

            }

            });

            // kill command

            $('#kill').click(function(){

            $('.example1').jqthumb('kill');

            });

            // kill all command

            $('#kill').click(function(){

            $.jqthumb('killall');

            });

            });

            /script

            BOWER

            bower install jqthumb

            可用參數(shù)

            source:圖片的URL屬性。例如:img src="path/image.jpg" /的source是 src。

            $('img').jqthumb({

            source : 'attr-src' // DEFAULT: src

            });

            classname:生成的縮略圖的class名稱。當你想使用外部css來渲染縮略圖時該參數(shù)十分有用。

            $('img').jqthumb({

            width : 200, // DEFAULT: 100

            height : '100%' // DEFAULT: 100

            });

            position:通過 X 和 Y作為關(guān)鍵參數(shù)來定義一個對象。y用于跳轉(zhuǎn)縮略圖上下位置,x用于跳轉(zhuǎn)縮略圖的左右位置。注意: position.x 和 position.y必須在定義的width和height的范圍里面。如果你用百分比來定義position.x 和 position.y,請確保它們在0-100%之間。

            $('img').jqthumb({

            position: {

            x : 20, // DEFAULT: '50%'

            y : '30%' // DEFAULT: '50%'

            }

            });

            show:是否在處理完成后顯示縮略圖:

            $('img').jqthumb({

            show : false // DEFAULT: true

            });

            responsive:該參數(shù)只是在瀏覽器不支持 CSS3 的時候才使用。為了在舊的瀏覽器上完成響應式效果,該插件在$(window).resize()事件被觸發(fā)的時候會重新計算。設置為0則在舊的瀏覽器中不使用響應式效果。在現(xiàn)代瀏覽器中不支持禁用響應式特性,可以使用method :"native"來禁止它。

            /* responsive only works for native method / older browsers */

            $('img').jqthumb({

            responsive : 10 // DEFAULT: 20

            });

            /* to disable responsive feature in modern method / browsers, switch method to native */

            $('img').jqthumb({

            method : 'native', // DEFAULT: auto

            responsive : 0 // DEFAULT: 20

            });

            zoom:放大或縮小縮略圖:

            $('img').jqthumb({

            zoom : 3 // DEFAULT: 1

            });

            method:該按比例是否縮略圖插件提供兩種方法:一種使在瀏覽器支持 CSS3 的時候使用,一種是瀏覽器不支持CSS3的時候使用。有時候你可能需要切換這兩種方法來做些測試。默認情況下,該插件會自動檢測瀏覽器是否支持CSS3然后調(diào)用相應的方法。

            $('img').jqthumb({

            method : 'native' // Availability: "auto", "modern", "native". DEFAULT: auto

            });

            before:這是在計算開始前的一個回調(diào)函數(shù)。該函數(shù)以參數(shù)的形式返回原始圖片的source和對象。如果你在初始化的時候使用了多個對象class名稱,那么這個函數(shù)會被調(diào)用兩次。

            $('img').jqthumb({

            before : function(originalImage){

            console.log(originalImage);

            }

            });

            after:這是在計算結(jié)束后的一個回調(diào)函數(shù)。該函數(shù)以參數(shù)的形式返回新生成的縮略圖對象。如果你在初始化的時候使用了多個對象class名稱,那么這個函數(shù)會被調(diào)用兩次。

            $('img').jqthumb({

            after : function(newThumb){

            $(newThumb).fadeIn();

            }

            });

            done:這是在所有圖片對象都被處理完畢后的一個回調(diào)函數(shù)。它返回所有縮略圖的數(shù)組對象。

            $('img').jqthumb({

            done : function(thumbnails){

            for(i in thumbnails)

            $(thumbnails[i]).fadeIn();

            }

            });

            可用命令

            $('img').jqthumb('kill'); // destroy the plugin

            $.jqthumb('killall'); // destroy all generated thumbnails on the page

            更多的使用方法

            ...

            img src="path/image.jpg" /

            ...

            script type="text/javascript"

            $(function(){

            $('img').jqthumb({

            width : 300,

            height : 200

            });

            });

            /script

            ...

            div data-jqthumb-src="path/image.jpg"/div

            ...

            script type="text/javascript"

            $(function(){

            $('div').jqthumb({

            source : 'data-jqthumb-src'

            });

            });

            /script

            ...

            div style="width: 100%; height:500px;"

            img src="path/image.png" /

            /div

            ...

            script type="text/javascript"

            $(function(){

            $('div').jqthumb({

            width : '100%',

            height : '100%'

            });

            });

            /script

            ...

            img class="my-img" data-jqthumb-src="path/image1.png" data-jqthumb-width="200" data-jqthumb-height="200" /

            img class="my-img" data-jqthumb-src="path/image2.png" data-jqthumb-width="200" data-jqthumb-height="180" /

            img class="my-img" data-jqthumb-src="path/image3.png" data-jqthumb-width="200" data-jqthumb-height="160" /

            img class="my-img" data-jqthumb-src="path/image4.png" data-jqthumb-width="200" data-jqthumb-height="140" /

            img class="my-img" data-jqthumb-src="path/image5.png" data-jqthumb-width="200" data-jqthumb-height="120" /

            ...

            script type="text/javascript"

            $(function(){

            $('.my-img').each(function(){

            var $img = $(this);

            $img.jqthumb({

            source : $img.attr('data-jqthumb-src'),

            width : $img.attr('data-jqthumb-width'),

            height : $img.attr('data-jqthumb-height')

            });

            });

            });

            /script

            ...

            img class="my-img" src="path/image.jpg" /

            ...

            script type="text/javascript"

            $(function(){

            $('.my-img').jqthumb({

            width : 300,

            height : 300,

            show : false, // By default the image would be shown immediately after processing. To disable, set it to false

            after : function(croppedImg){ // This callback returns an object

            $(croppedImg).fadeIn(); // This would fade in the cropped image

            }

            });

            });

            /script

            ...

            img class="my-img" src="path/image1.jpg" /

            img class="my-img" src="path/image2.jpg" /

            img class="my-img" src="path/image3.jpg" /

            ...

            script type="text/javascript"

            $(function(){

            $('.my-img').jqthumb({

            width : 300,

            height : 300,

            show : false, // By default the image would be shown immediately after processing. To disable, set it to false

            done : function(allCroppedImgs){ // This callback returns an array

            for(i in allCroppedImgs){

            $(allCroppedImgs[i]).fadeIn(); // This would fade in the cropped images one by one

            }

            }

            });

            });

            /script

            帶縮略圖多屏輪播的jQuery左右滾動banner焦點圖代碼,到了第十一張小圖片就不自動滾下去了?

            肯定的 你要那種連續(xù)滾動的 要在小圖前后各家一張圖片才可以 最前面加最后一張最后面加最前面 然后判斷

            JQuery實現(xiàn)input上傳圖片顯示縮略圖

            最近做一套手機商城頁面,在退款申請頁面有上傳圖片顯示縮略圖的功能,以前沒有做過這個,所以整理了一下。

            在這里我把上傳按鈕input變成了透明色,然后用一個設置了+號背景圖的span蓋在上面實現(xiàn)了上傳按鈕的樣式改變,如不用圖片也可以自行設置span樣式來達到想要的效果。

            給 input 綁定了一個 change() 事件,當事件被觸發(fā)后,首先會檢測該瀏覽器是否支持 HTML5 FileReader API ,如果支持就會執(zhí)行一個 each 循環(huán)。

            在每一個循環(huán)里,用正則表達式判斷文件后綴名是否為圖片格式,如果是圖片格式,如果是圖片,就會用 readAsDataURL 方法來讀取其 BASE64編碼,然后以其為img元素的 src 屬性值,添加 img 元素到 #imgPreview 中,實現(xiàn)上傳顯示縮略圖。

            當前題目:縮略圖jquery,縮略圖英文
            URL鏈接:http://www.jbt999.com/article22/phjejc.html

            成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設、用戶體驗虛擬主機、域名注冊、ChatGPT、微信公眾號

            廣告

            聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:[email protected]。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

            商城網(wǎng)站建設

              <del id="d4fwx"><form id="d4fwx"></form></del>
              <del id="d4fwx"><form id="d4fwx"></form></del><del id="d4fwx"><form id="d4fwx"></form></del>

                    <code id="d4fwx"><abbr id="d4fwx"></abbr></code>
                  • 日本美女操逼软件 | 暖暖无码 | 欧美不卡一区 | 婷婷欧美 | 午夜福利3 |