//先儲存圖片原始大小,之後調整不可以原始大小大 var UML_img_width = []; var 說明_img_width = []; $(window).load(function () { var i = 0; $('.UML img').hide(); $('.說明 img').hide(); $('.UML img').each(function () { UML_img_width.push($(this).width()); if ($(this).width() > $('.UML_heading').width()) { $(this).width($('.UML_heading').width() - 10); } i++; }) $('.說明 img').each(function () { 說明_img_width.push($(this).width()); if ($(this).width() > $('.UML_heading').width()) { $(this).width($('.UML_heading').width() - 10); } i++; }) $('.UML img').show(); $('.說明 img').show(); }) //圖片自動調整大小 $(window).resize(function () { console.log('UML_heading:' + $('.UML_heading').width()); //alert($('.UML_heading').width()); var i = 0; $('.UML img').hide(); $('.說明 img').hide(); $('.UML img').each(function () { //alert($(this).width() + ':' + img_width[i]); if (UML_img_width[i] > $('.UML_heading').width()) { //alert(img_width[i]); $(this).width($('.UML_heading').width() - 10); } $(this).show(); i++; }) i = 0; $('.說明 img').each(function () { if (說明_img_width[i] > $('.UML_heading').width()) { $(this).width($('.UML_heading').width() - 10); } $(this).show(); i++; }) })
目前分類:jQuery (71)
- Apr 22 Wed 2015 18:25
jQuery 圖片隨視窗自動調整大小
- Apr 22 Wed 2015 17:42
jQuery selector class child each
$selector2 = $('ul.topnav').each(function(){ alert($(this).children().length);});
- Apr 10 Fri 2015 10:15
jQuery metisMenu
- Apr 02 Thu 2015 17:48
Ajax file upload
【成功案例】
http://www.dotnettips4u.com/2013/02/ajax-file-upload-in-aspnet.html
- Mar 27 Fri 2015 17:39
jQuery DataTable page事件
- Mar 27 Fri 2015 12:07
JQuery Find and change style of a string
<div>
<p>
- Jan 30 Fri 2015 11:18
[ASP.NET & jQuery]使用jQuery的Ajax存取資料(ashx,aspx,asmx)
感謝好文,終於要比較進入狀況了!哈雷路亞~~~
- Jan 30 Fri 2015 09:56
jQuery用data- 取 data-值
$('*[data-forumid="2"]').attr('data-id');
- Jan 29 Thu 2015 18:13
jQuery取aspx資料
$.get("英雄聯盟隊伍清單.aspx?id=" + $("#applyBtn").attr('data-id'), function (data, status) { $('#temp_teams').html(data); //alert("Data: " + data + "\nStatus: " + status); console.log($('#temp_teams').text()); });
- Jan 29 Thu 2015 15:39
jQuery驗證email
function IsEmail(email) { var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/; return regex.test(email); } if (IsEmail($('#<%=txt_lol_電子信箱.ClientID%>').val())) { alert('valid'); }else { alert('err'); }
- Jan 29 Thu 2015 12:07
jQuery設定input text只能輸入數字
$('.numbersOnly').keyup(function () { if (this.value != this.value.replace(/[^0-9\.]/g, '')) { this.value = this.value.replace(/[^0-9\.]/g, ''); } });
- Jan 29 Thu 2015 12:06
jQuery判別checkbox是否勾選
- Jan 21 Wed 2015 09:43
jQuery call c# function
http://www.morgantechspace.com/2014/01/Call-Server-Side-function-from-JavaScript-in-ASP-NET.html
- Jan 14 Wed 2015 16:43
jQuery 一個按鈕上傳圖片
- Jan 14 Wed 2015 16:39
jQuery Guid 命名
function createGuid() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
- Dec 18 Thu 2014 15:06
jQuery 限制checklist 選取上限
$("input[type=checkbox][name=cate]").click(function(){var bol = $("input[type=checkbox][name=cate]:checked").length >=4;
$("input[type=checkbox][name=cate]").not(":checked").attr("disabled",bol);});
- Dec 16 Tue 2014 14:22
jQuery驗證fileupload
var ext = $('#my_file_field').val().split('.').pop().toLowerCase();if($.inArray(ext,['gif','png','jpg','jpeg'])==-1){ alert('invalid extension!');}
- Dec 16 Tue 2014 12:29
jQuery驗證url
var myVariable ="http://www.google.com/";if(/^([a-z]([a-z]|\d|\+|-|\.)*):(\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?((\[(|(v[\da-f]{1,}\.(([a-z]|\d|-|\.|_|~)|[!\$&'\(\)\*\+,;=]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f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(myVariable)){ alert("valid url");}else{ alert("invalid url");}
- Dec 11 Thu 2014 14:20
TOP按鈕jQuery
$(window).scroll(function() { if ( $(this).scrollTop() > 300){ $('#gotop').fadeIn("fast"); } else { $('#gotop').stop().fadeOut("fast"); } });
- Oct 24 Fri 2014 17:36
jQuery Loading.gif 產生器