jquery淡水化版banner非同期画像の文字効果切換画像の効果


 
<pre code_snippet_id="280064" snippet_file_name="blog_20140408_1_8982765" name="code" class="html"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset='utf-8'/>
<title> banner, </title>
<meta name="keywords" content=" banner, banner">
<meta name="description" content=" banner" />
<style type="text/css">
body,ul,li,ol{list-style:none;padding:0px;margin:0px;font-size:12px;}
img{border:0px;}

.bzBanner{width:100%; min-width:980px; height:auto; overflow:hidden; position: relative; }
.bzBanner .content,.bzBanner .col,.bzBanner .col a{width:100%; height:100%; position: absolute; top:0px; left:0px; }
.bzBanner .btn{position: absolute; bottom:25px; right:50px; z-index:5; }
.bzBanner .btn i{display:block; float: left; width:15px; height:15px; padding:0 5px; border-radius:15px; margin-left:15px; background:white; overflow:hidden; opacity:0.4; filter:alpha(opacity=40); cursor:pointer; }
.bzBanner .btn i:hover{background:#9C0; }
.bzBanner .btn i.act{opacity:0.8; filter:alpha(opacity=80); background:#9C0; }
.bzBanner .pre,.bzBanner .next{display:inline-block; width:72px; height:72px; background:url(./bzbanner/btn.png) no-repeat; position:absolute; top:50%; margin-top:-50px; z-index:3; }
.bzBanner .pre{left:30px; }
.bzBanner .next{right:30px; background-position:0 -72px; }
.bzBanner .pre:hover{background-position:0 -144px; }
.bzBanner .next:hover{background-position:0 -216px; }
.bzBanner .col a{color:white; }
.bzBanner .col span{display:inline-block; width:550px; height:200px; background:rgba(0,0,0,.1); position:absolute; z-index:3; bottom:70px; left:130px; }
.bzBanner .col span h3{font-weight:normal; font-size:28px; font-weight:normal; font-family: ; padding:0px; margin:0px; padding-left:20px; line-height:70px; text-shadow:1px 1px rgba(0,0,0,.3); }
.bzBanner .col span p{display:inline-block; width:90%; line-height:25px; font-size: 14px; font-family: ; margin:0px; padding:0px; padding-left:20px; text-shadow:1px 1px rgba(0,0,0,.3); }

</style>
</head>
<body>

<div class='bzBanner'>
<div class='content'>
<div class='col'>
<a href='javascript:;' >
<img src='./bzbanner/12.jpg' width=100% />
<span>
<h3> : & 《 》</h3>
<p> & 《 》MV ! “ ” , , 。 , 。</p>
</span>
</a>
</div>
<div class='col'>
<a href='javascript:;' >
<img src='./bzbanner/13.jpg' width=100% />
<span>
<h3> :It Began With A Fallen Leaf</h3>
<p> (Priscilla Ahn) 《It Began With A Fallen Leaf》MV ! , , 。 , , 。</p>
</span>
</a>
</div>
<div class='col'>
<a href='javascript:;' >
<img src='./bzbanner/14.jpg' width=100% />
<span>
<h3> : </h3>
<p> 《 》MV ! + , ,MV , , !</p>
</span>
</a>
</div>
<div class='col'>
<a href='javascript:;' >
<img src='./bzbanner/15.jpg' width=100% />
<span>
<h3> ・FAN </h3>
<p> , 。 【 ・ 】! , 。 , , , , , 1120 !Android IOS …</p>
</span>
</a>
</div>
</div>
<div class='btn'><i></i><i></i><i></i><i></i></div>
<a class='pre' href='javascript:;' title=' ' ></a>
<a class='next' href='javascript:;' title=' ' ></a>
</div>

<script type="text/javascript" src="./jquery-1.10.2.min.js" ></script>
<script type="text/javascript" src="./bzBanner.min.js" ></script>
<script type="text/javascript">
$(function(){ benzi.bzBanner(); });
</script>
</body>
</html></pre>
<pre></pre>
<pre code_snippet_id="280064" snippet_file_name="blog_20140408_2_455436" name="code" class="html">----------html---------------------------------------------------------------------------------</pre><pre code_snippet_id="280064" snippet_file_name="blog_20140408_2_455436" name="code" class="html"><pre code_snippet_id="280064" snippet_file_name="blog_20140408_2_455436" name="code" class="javascript">/*==================================
@ : banner +
@ :2013.11.22
@ :BENZI.PW
@ :

:
CSS HTML 。
benzi.bzBanner();

js
container:
cols:
btns:
act:
pre:
next:


====*/
var benzi = {
bzBanner : function(){

// ( )
var values = {
container:$('.bzBanner'),
cols:$('.bzBanner .col'),
btns:$('.bzBanner .btn i'),
act:'act',
pre:$('.bzBanner .pre'),
next:$('.bzBanner .next'),
now:0
}

// , zindex,
// col:
// pre:
// now:
//-----------------------
var weaken = function( pre,now ){
var col = values.cols;
col.css({ zIndex:1 }).eq( pre ).css({ zIndex:2 });
col.eq( now ).css({ zIndex:3,opacity:0 }).stop(true).animate({ opacity:1 },700);
}

// ,
// now:
//-------------------
var increase = function( now ){
var pre = now ,now = pre + 1;
if( now >= values.cols.length ) now = 0;
return { pre:pre ,now:now };
}

//
//-------------------
var degression = function( now ){
var pre = now ,now = pre - 1;
if( now < 0 ) now = values.cols.length-1;
return { pre:pre ,now:now };
}

//
//---------------------
var btnStyle = function( now ){
if( values.btns && values.act )
values.btns.removeClass( values.act ).eq( now ).addClass( values.act );
}

// , ,
//----------------------
var button = function(){
values.btns.click(function(){
var now = $(this).index();
if( values.now != now ){
weaken( values.now ,now );
btnStyle( now );
text( now );
values.now = now;
}
});
}

//
// aspect: ,0 ,1
//----------------------
var change = function( aspect ){
var val = aspect ? degression( values.now ) : increase( values.now );
weaken( val.pre ,val.now );
btnStyle( val.now );
text( val.now );
values.now = val.now;
}

//
//-----------------------
var shortcut = function(){
values.pre.click(function(){ change(1); });
values.next.click(function(){ change(); });
}

// , ,
//------------------------
var text = function( now ){
values.cols.find('span').css({ opacity:0 }).eq( now ).stop(true).delay(500).animate({ opacity:1 },1000);
values.cols.find('h3').css({ opacity:0 }).eq( now ).stop(true).delay(500).animate({ opacity:1 },500);
values.cols.find('p').css({ opacity:0 }).eq( now ).stop(true).delay(1000).animate({ opacity:1 },500);
}

//
//-------------------------------
$(window).resize(function(){
values.container.height( values.cols.find('img').height() );
}).resize();

// ,degrees , ( ), values.now
// time:
//---------------------
var loop,play = function( time ){
clearTimeout( loop );
loop = setTimeout(function(){
change();
play( 3000 );
}, time );
}

//
//---------------------
var control = function(){
values.container.hover(function(){
clearTimeout( loop );
},function(){
play( 2000 );
});
}

// ,
//--------------------
var initialize = function(){
var now = values.now;
weaken( values.cols.length-1 ,now );
if(values.btns ) button();
if( values.pre && values.next ) shortcut();
btnStyle( now );
text( now );
play( 4000 );
control();
}

//
//---------------------
initialize();

}

}
</pre><br>
<br>
<pre></pre>
<pre code_snippet_id="280064" snippet_file_name="blog_20140408_2_455436" name="code" class="html"></pre><pre code_snippet_id="280064" snippet_file_name="blog_20140408_2_455436" name="code" class="html"></pre>
<p></p>
<pre></pre>

</pre>