2012年2月28日火曜日

シンプルでアニメーションの時間も設定できるjQueryスライドショープラグイン

<div id="slideshow">
    <img src="img/img1.jpg" width="500" alt="" />
    <img src="img/img2.jpg" width="500" alt="" />
    <img src="img/img3.jpg" width="500" alt="" />
</div>

<style type="text/css"> 
<!--    
#slideshow {
    position:relative;
}
#slideshow img {
    position:absolute;
    top:0;
    left:0;
    z-index:8;
}
#slideshow img.active {
    z-index:10;
}
#slideshow img.last-active {
    z-index:9;
}
--> 
</style>


<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
       <script type="text/javascript">
          function slideSwitch() {
              var $active = $('#slideshow img.active');
              if ( $active.length == 0 ) $active = $('#slideshow img:last');
              var $next =  $active.next().length ? $active.next() : $('#slideshow img:first');
              $active.addClass('last-active');
              $next.css({opacity: 0.0})
                  .addClass('active')
                  .animate({opacity: 1.0}, 1000, function() {
                      $active.removeClass('active last-active');
                });
          }
          $(function() {
              setInterval( "slideSwitch()", 4000 );
          });
</script>

2012年2月23日木曜日

2枚の画像を重ねるCSS。(マスクに使用)

白の穴空きpng画像をマスクにつかって
下には正方形の写真を配置。

2つのimg画像をdivでくくって
divにposition:relative;
マスクの方(2枚目の画像)にabsoluteをかける。

参考サイト

jQueryプラグインなスライダー slider.js

横スライドし続ける。さすが。

2012年2月22日水曜日

HTMLサイトでよく使う機能をまとめたライブラリ群「SimpleLib」

参考サイト

自由に画像にマスクをかけられるJavaScriptライブラリ「Edge.js」

参考サイト:http://phpspot.org/blog/archives/2007/08/javascriptedgej.html

IE6/7/8をCSS3対応にする 「CSS3 PIE」

CSS3 PIEの使い方
(1)CSS3 PIEからファイルをダウンロード。
(2)ファイルの中にあるPIE.htcだけを任意のホームページサーバーディレクトリに
入れる。(ドメイン直下とか)
(3)CSSに以下のように記述する。


(4)完了、注意点は「PIE.htc」のパスは角丸を効かせるhtmlまでのパスを
書く事。また-pie-border-radius:0 0 0 0;はPIEのジェネレーターでは出てこない,
左上から時計回りに4つの角丸を指定出来る。

(5)バグに関して
radiusを効かせている要素がIEで消えるバグがあったが
この要素のCSSの最初にpositon:relative;を効かせたら直った。
以下にバグ解決の参考サイトを載せる。

「CSS3 PIE」参考サイト
・コリス
・「IEの角丸を一行で指定出来る」参考サイト
Firefox 13 リリース、接頭辞 -moz-border-radius* と -moz-box-shadow のサポート終了
・CSS3 PIE」がうまく動かなかった時の対処法

2012年2月7日火曜日

ブログの投稿をfacebookへ連動させる(テストを兼ね)


Facebookのアプリ「RSS Graffiti」を使ってブログの投稿をfacebookへ連動させられる。
しかし設定時にRSS Graffitiのエラーが出るので注意。

参考ソース:ブログの投稿をFacebook(フェイスブック)に連動、連携させる。