当前位置: 移动技术网 > IT编程>网页制作>CSS > 用纯CSS+DIV写的漂亮Flash幻灯片及SQL标签教程!

用纯CSS+DIV写的漂亮Flash幻灯片及SQL标签教程!

2017年12月12日  | 移动技术网IT编程  | 我要评论
用纯css+div写的漂亮flash幻灯片及sql标签教程!

下面代码有点多!但做出来你肯定喜欢!

用纯css+div写的漂亮flash幻灯片及sql标签教程!我不想废话了,开门见山吧。

先看演示 :http://www.gz7y.com   点精彩推荐即可看见!

如果下面代码你看不懂或者做不出来,明天等待我的视频吧。

css如下:
<style type=text/css>
<!--
#f_div{width:230px; height:205px; margin:0 auto; overflow:hidden;}
#f_imgdiv{width:100%; height:205px; overflow:hidden;}
#f_img{filter:progid:dximagetransform.microsoft.fade(overlap=1.00); border:0;}
#f_infodiv{width:100%;top:-16px !important;top:-18px; position:relative;}
#f_buttondiv{width:100%; height:17px; overflow:hidden; text-align:left;}
#f_line{width:100%;height:1px;background:#fff; overflow:hidden;filter:progid:dximagetransform.microsoft.alpha(startx=0, starty=0, finishx=50, finishy=100,style=1,opacity=0,finishopacity=100)}
#f_buttondiv div{width:1px;height:17px; background:#fff; float:right;}
#f_buttondiv .bg{width:17px; height:17px; background:#fff; float:right; filter:alpha(opacity=40);}
#f_buttondiv a{width:17px;height:11px !important;height:17px;float:right;padding-top:5px;color:#fff;font-family:arial, helvetica, sans-serif;font-size:10px; line-height:10px; text-align:center;display:block;overflow:hidden;text-decoration:none;position:absolute;}
#f_buttondiv a:link,#f_buttondiv a:visited,#f_buttondiv a:active{color:#000;}
#f_buttondiv a:hover{background:#ff840c;color:#fff;}
#f_buttondiv a.on:link,#f_buttondiv a.on:visited,#f_buttondiv a.on:active,#f_buttondiv a.on:hover{background:#ff840c;color:#fff;}
#f_buttondiv a.on:hover{background:#ff6600;}
-->
</style>

sql循 环 体 如下:


<div id="f_div">
<!--图片区域-->
<div id="f_imgdiv"></div>
<div id="f_infodiv">
<!--数字按钮区域-->
<div id="f_buttondiv"></div>
</div>
</div>
<script>
var imgwidth=250;
var imgheight=205;
var _timeout_=5000;
var show_text = true; //是否显示焦点文字
var timeout=_timeout_;
var timeout2=_timeout_/2;//onmouseout img后需要切换的时间
var now=0;              //第一张图
var target="_blank";   //打开方式
var button_on ='on'; //当前焦点对应按钮的样式名
var button_off ='';//非当前焦点对应按钮的样式名
//不可修改区域
var imgurl = new array();
var imgtext = new array();
var imglink = new array();
var imgalt= new array();
//var menulist = new array();//菜单menu
var ver=2; //兼容浏览器版本 默认2 为非ie
var firsttime=true;
var n =-1;
[loop=5]
imgurl[++n]='{$field(picurl,text,0,...,0,)}';
imgtext[n]='<a href="{$field(id,getinfourl,1,1)}" target="_blank" class=linkblack>{$field(title,text,0,...,0,)}</a>';
imglink[n]='{$field(id,getinfourl,1,1)}';
imgalt[n]='{$field(title,text,0,...,0,)}';
[/loop]
var count=0;
for (i=0;i<imgurl.length;i++) {
if( (imgurl[i]!="") && (imgtext[i]!="")&& (imglink[i]!="")&& (imgalt[i]!="")) {
count++;
} else {
break;
}
}
function p$(string){
document.write(string);
}
function $(id){
return document.getelementbyid(id);
}
//固定图片size
p$("<style> #f_img { width:"+imgwidth+"px;height:"+imgheight+"px;</style>");
function change(){
if (ver==1){
with($('f_img').filters[0]){
transition=1;
apply();
play();
}
}
if (firsttime){ firsttime=false;timeout=_timeout_/1000;}
else{
$('f_img').src=imgurl[now];
$('f_img').alt=imgalt[now];
$('f_imglink').href=imglink[now];
for (var i=0;i<count;i++) {
$('b'+i).classname="button";
//$('f_menu'+i).classname="";
}
$('b'+now).classname="on";
//$('f_menu'+now).classname="on";
now=(now>=imgurl.length-1)?0:now+1;
timeout=_timeout_;
}
thetimer=settimeout("change()", timeout);
}
function b_change(num){
window.clearinterval(thetimer);
now=num;
firsttime=false;
change();
}
//draw 渐变line (即css:f_line)
function draw_line(){
var div = document.createelement("div");
div.id = 'f_line';
$('f_infodiv').insertbefore(div,$('f_infodiv').childnodes.item(0));
}
//表现层 start
//图片
var a = document.createelement("a");
a.id="f_imglink";
a.target=target;
a.href=imglink[now];
$('f_imgdiv').appendchild(a);
var img = document.createelement("img");
img.id="f_img";
img.width=imgwidth;
img.height=imgheight;
img.src=imgurl[now];
img.alt=imgalt[now];
a.appendchild(img);
//数字按钮
for (var i=count-1;i>=0;i--){
var div_bg = document.createelement("div");
div_bg.id = 'div_bg'+i;
div_bg.classname='bg';
$('f_buttondiv').appendchild(div_bg);
var a = document.createelement("a");
a.id = 'b'+i;
a.classname = (i==now+1)?"button_on":"button_off";
a.title=imgalt[i];
a.innerhtml=i+1;
a.href='javascript:b_change('+i+')';
$('div_bg'+i).appendchild(a);
var div= document.createelement("div");
$('f_buttondiv').appendchild(div);
}
//表现层 end
$('f_img').onmouseover=function(){window.clearinterval(thetimer);}
$('f_img').onmouseout=function(){thetimer=settimeout("change()", timeout2);}
try{  //滤镜版本
new activexobject("dximagetransform.microsoft.fade");
$('f_img').filters[0].play();
ver=1;
draw_line();
}
catch (e){ver=2;}
var thetimer = settimeout("change()", _timeout_/1000);
</script>



别忘了sql查询语句:

--------------------------------------------------------------------------------
select top 5 id,title,adddate,picurl,slide,verific from ks_article where verific=1 and slide=1 order by adddate desc  --------------------------------------------------------------------------------


如果你还不会做或者做不出来更或者看不懂代码,那请告知我,我把视频发出来。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网