This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 通常のcontainerが750px-970px-1170pxなのでsmallの間にmiddeleを追加 */ | |
@media (min-width: 768px) { | |
.container-small { | |
width: 300px; | |
} | |
.container-middle { | |
width: 500px; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* javascriptのコード */ | |
function copyright(){ | |
myDate = new Date(); | |
myYear = "Copyright © "+myDate.getFullYear()+" Company Name Allrights Reserved."; | |
document.write(myYear); | |
} | |
/* htmlのコード */ | |
<script type="text/javascript">copyright();</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*コンテキストメニューが非表示に*/ | |
$(document).ready(function(){ | |
$(document).bind("contextmenu",function(e){ | |
return false; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ページ内リンクをスムーズに移動させます。 */ | |
$(document).ready(function() { | |
$('a[href*=#]').click(function() { | |
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') | |
&& location.hostname == this.hostname) { | |
var $target = $(this.hash); | |
$target = $target.length && $target | |
|| $('[name=' + this.hash.slice(1) +']'); | |
if ($target.length) { | |
var targetOffset = $target.offset().top; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 要素の中身を書き換え */ | |
$(document).ready(function() { | |
$('#my-id').replaceWith('<div>置換後の文字列</div>'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* クリック要素を大きくできます */ | |
$(document).ready(function() { | |
$("div").click(function(){ | |
//aタグから遷移先を自動取得します。 | |
window.location=$(this).find("a").attr("href"); | |
return false; | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 画面の中心に要素を配置 */ | |
$(document).ready(function() { | |
jQuery.fn.center = function () { | |
this.css("position","absolute"); | |
this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px"); | |
this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px"); | |
return this; | |
} | |
$("#my-id").center(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$("p").size(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//テキストボックスからフォーカスが外れた時 | |
//ボタンを押したとき(id指定) | |
//テキストをクリックしたとき(タグとクラス指定) | |
jQuery(function ($) { | |
// テキストボックスからフォーカスが外れた時 | |
$("#form1 [name=text1]").blur(function() { | |
alert($('#form1 [name=text1]').val()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ページトップへスクロールする */ | |
/* css */ | |
.toTop { | |
margin-top: 400px; | |
display: inline-block; | |
background: #0bd; | |
padding: 15px; | |
color: #fff; | |
cursor: pointer; | |
} |
OlderNewer