PIXNET Logo登入

程式設計@筆記

跳到主文

一個常常忘記code的php工程師寫下的筆記。

部落格全站分類:不設分類

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 11月 06 週二 201810:33
  • [Jquery]停止所有youtube播放(iframe embed)

$("iframe").each(function() {
var src= $(this).attr('src');
$(this).attr('src',src);
});
 
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(113)

  • 個人分類:JQuery
▲top
  • 4月 02 週一 201816:47
  • [Jquery]讓html檔也能使用include方法

<div id="top"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$("#top").load( "top.html");
</script>
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(3,937)

  • 個人分類:JQuery
▲top
  • 1月 03 週三 201815:36
  • 使用Jquery讓你的iframe也能RWD(嵌入youtube專用)

<script>
// Find all iframes
var $iframes = $("iframe" );
// Find &#x26; save the aspect ratio for all iframes
$iframes.each(function () {
$( this ).data( "ratio", this.height / this.width )
// Remove the hardcoded width &#x26; height attributes
.removeAttr( "width" )
.removeAttr( "height" );
});
// Resize the iframes when the window is resized
$( window ).resize( function () {
$iframes.each( function() {
// Get the parent container&#x27;s width
var width = $( this ).parent().width();
$( this ).width( width )
.height( width * $( this ).data( "ratio" ) );
});
// Resize to fix all iframes on page load.
}).resize();
</script>
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(454)

  • 個人分類:JQuery
▲top
  • 12月 22 週五 201711:40
  • [JQuery][屬性] 使用removeAttr() 方法從被選元素中移除屬性

 
用法
$("#元素").removeAttr('屬性值');

例:
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("p").removeAttr("style");
});
});
</script>
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(124)

  • 個人分類:JQuery
▲top
  • 12月 22 週五 201711:12
  • [JQuery][屬性] 使用.prop() 取得或設置 checked 、selected、readonly 、disabled 屬性

例:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>prop demo</title>
<style>
p {
margin: 20px 0 0;
}
b {
color: blue;
}
</style>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<input id="check1" type="checkbox" checked="checked">
<label for="check1">Check me</label>
<p></p>
<script>
$( "input" ).change(function() {
var $input = $( this );
$( "p" ).html(
".attr( \"checked\" ): <b>" + $input.attr( "checked" ) + "</b><br>" +
".prop( \"checked\" ): <b>" + $input.prop( "checked" ) + "</b><br>" +
".is( \":checked\" ): <b>" + $input.is( ":checked" ) + "</b>" );
}).change();
</script>
</body>
</html>
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(275)

  • 個人分類:JQuery
▲top
  • 12月 22 週五 201710:47
  • [JQuery][屬性] html()法方 - 設定被選中元素的內容 (inner HTML)

例:返回被選中元素的內容
$("元素").html() 
例:設定一個值,並覆蓋被選中元素的所有內容
$(元素).html(內容)
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(31)

  • 個人分類:JQuery
▲top
  • 12月 21 週四 201714:37
  • [JQuery][屬性] 使用 hasClass() 檢查被選元素是否包含指定的 class

檢查第一個段落是否擁class等於"intro"
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
alert($("p:first").hasClass("intro")); //顯示true
});
});
</script>
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(40)

  • 個人分類:JQuery
▲top
  • 12月 20 週三 201710:16
  • [JQuery][屬性] 使用 attr() 方法操作屬性(變更值、取得屬性值、多重屬性變更)

 
1.變更屬性值
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("img").attr("width","180"); //變更屬性值
});
});
</script>
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(205)

  • 個人分類:JQuery
▲top
  • 12月 19 週二 201714:28
  • [JQuery][屬性] addClass 將指定的css class添加到元素集中的每個元素

 
一次可以添加一個以上的css class,由一個空格分隔,以匹配元素的集合,如下所示:
$("p").addClass( "myClass yourClass" );
這種方法通常用於.removeClass()將元素的類從一個切換到另一個,如下所示:
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(459)

  • 個人分類:JQuery
▲top
  • 11月 01 週三 201716:37
  • [JQuery]按下div區塊,連結出去

jQuery('#id').on('click', function(){
window.location='網址';
});
(繼續閱讀...)
文章標籤

stockwfj3 發表在 痞客邦 留言(0) 人氣(295)

  • 個人分類:JQuery
▲top
12»

ad

文章搜尋

熱門文章

  • (19,102)[php]json_decode 將json轉成陣列或object
  • (12,391)[php] array_push 一個或多個單元加入陣列末尾
  • (1,859)[php]session_save_path 讀取與設置當前會話的保存路徑
  • (1,820)[php]file_put_contents() 函數把一個字符串寫入文件中
  • (1,783)[php]取得使用者IP位置
  • (460)[php]str_split — 將字符串轉換為數組
  • (381)[php] PHP將網址字串轉換成URL
  • (237)php模擬String.TrimEnd函數,移除最後一個逗號或符號
  • (225)[php] array_walk — 對陣列中的每個成員應用用戶函數
  • (97)[php]session_abort 丟棄session陣列的變化和完成session

文章分類

toggle 其它分類 (8)
  • JQuery (16)
  • Android (20)
  • html (7)
  • 其它 (5)
  • codeigniter (13)
  • Mysql (6)
  • javascript (12)
  • css (26)
  • php實用技巧 (17)
  • php常用函數 (44)
  • PDO函數 (36)
  • GD函數 (106)
  • php字符串函數 (70)
  • php陣列 (62)
  • php日期函數 (38)
  • Directory函數 (8)
  • Filesystem函數 (58)
  • Math 函數 (44)
  • json函數 (2)
  • Session 函数 (14)
  • Cookies操作 (7)
  • ftp函數 (20)
  • ctype函數 (8)
  • Misc 雜項函數 (19)
  • cURL 函数 (25)
  • MySQLi函數 (53)
  • SimpleXML函數 (23)
  • Calendar 日曆函數 (17)
  • URL 函數 (10)
  • iconv 函數 (11)
  • Network函數 (24)
  • Multibyte String (45)
  • Zip壓縮函數 (22)
  • Variable handling (28)
  • 未分類文章 (1)

最新文章

  • 解決CKEditor中img標籤自動添加style樣式的問題-禁止自動設置width和height
  • [css]強迫匯出excel的欄位格式轉為純文字
  • [html]使用frame無框轉址
  • [css]解決英文字穿過text-decoration-line底線問題
  • [Jquery]停止所有youtube播放(iframe embed)
  • [Mysql]將字串欄位轉成數字排序或加總金額(使用CAST)
  • [Jquery]讓html檔也能使用include方法
  • [html]textarea預設文字並換行
  • [html5]使用正則 pattern 判斷日期格式
  • [CSS]當文字要壓在圖片上,並作RWD的自適應

文章精選