.htaccessでPHPのファイルアップロードサイズの上限値を変更
2022.02.5
PHPを使用して画像(動画・PDF等)をアップロードするフォームを作成した際に、ファイル…

飲食店サイトを作成した際にしようした簡単なスライドショーの方法をメモ。
画像の切り替わりはフェードイン・フェードアウト方式。
速度も自由に変更可能。
<figure class="mainimageTop">
<ul>
<li class="active"></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</figure>
<script>
$(function() {
setInterval('slideSwitch()', 5000 );
//5000は次の画像に切り替わるまでのミリ秒
});
</script>
.mainimageTop{
width: 100%;
position: fixed;
z-index: -1;
top: 0;
left: 0;
overflow: hidden; }
.mainimageTop::after{
content: '';
width: 60%;
height: 100%;
display: block;
background-image: -webkit-gradient(linear,left top,right top,from(rgba(0,0,0,0)),color-stop(0.78, rgba(0,0,0,1.0)),to(#000));
background-image: -moz-linear-gradient(left,rgba(0,0,0,0),rgba(0,0,0,0.95) 78%,#000);
position: absolute;
top: 0;
right: 0;
z-index: 10; }
.mainimageTop ul li{
width: 100%;
height: 100%;
box-sizing: border-box;
position: absolute;
top: 0;
left: 0;
margin: auto;
z-index: 5; }
.mainimageTop ul li.active{
z-index: 7; }
.mainimageTop ul li.next-active{
z-index: 6; }
.mainimageTop ul li:nth-of-type(1){
background: url(画像URL) center fixed;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover; }
.mainimageTop ul li:nth-of-type(2){
background: url(画像URL) center fixed;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover; }
.mainimageTop ul li:nth-of-type(3){
background: url(画像URL) center fixed;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover; }
.mainimageTop ul li:nth-of-type(4){
background: url(画像URL) center fixed;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover; }
.mainimageTop ul li:nth-of-type(5){
background: url(画像URL) center fixed;
background-size: cover;
-webkit-background-size: cover;
-moz-background-size: cover; }
function slideSwitch(){
var $active = $('.mainimageTop ul li.active');
if($active.length == 0 ) $active = $('.mainimageTop ul > li:last');
var $next = $active.next().length ? $active.next() : $('.mainimageTop ul > li:first');
$active.addClass('next-active');
$next.css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0},3000,function(){
//3000は画像が表示されるまでにかかるミリ秒
$active.removeClass('active next-active');
});
};

2022.02.5
PHPを使用して画像(動画・PDF等)をアップロードするフォームを作成した際に、ファイル…

2020.10.3
テキストエリア等で入力した文字の中にURLを含んでいた場合に、自動で認識してリンクタグを…

2024.03.30
外部ファイル(CSVファイル等)を読み込んでサイト内に表示する際に、保存時の文字コードが…

2020.12.5
メールフォームからメールを送信する際に、画像(ファイル)を添付できるようにしてほしいとの…

2023.12.2
ワードプレスの投稿のカテゴリー機能を、目的ごとに使い分けたいというご要望があった際に、カ…

2020.08.1
動画ファイルをCMS化して保存するときに、多くの場合はファイルパスをデータベース(MyS…

2022.09.24
パソコンやスマートフォンの戻るボタンを使って画面を戻す(ブラウザバックする)時があります…

2022.02.19
画像データ等をサーバーにアップロードする際、一点づつアップロードしても良いけれど、ファイ…

2020.08.15
フォームの入力値やURLのパラメータ等、文字列や数値を受け取る際に正規表現を利用してバリ…

2019.12.29
メールフォーム等での入力値チェック(バリデーション)。PHPの「preg_match」(…

ホームページ上にビフォーアフターの画像を掲載する場合に、同じ画角の画像を対比させて表示し…

以前、飲食店サイトを制作した際に、記念写真を掲載する目的でメインビューに使っていたスクリ…

時間を指定して表示を切り替える際にPHPを使用することが多かったのだけれど、利用している…