小编教你JS特效拖动滚动条可以评分效果,小编感觉挺不错,用时候可能需要ASP/PHP或其它语言配合取值并写入数据库,这是前台的实现。
直接上代码 看看JS的神奇吧!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>JS实现拖动<a href="https://www.jb51.net/zt/gundongtiao/" target="_blank" class="infotextkey">滚动条</a>评分的特效 (www.jb51.net)</title> <style> body{ margin:50px; ; } .scale_panel{ font-size:12px; color:#999; width:200px; position:absolute; <a href="https://www.jb51.net/article/15092.html" target="_blank" class="infotextkey">line-height</a>:18px; left:60px; top:-0px; } .scale_panel .r{ float:right; } .scale span{ width:8px; height:16px; position:absolute; left:-2px; top:-1px; cursor:pointer; } .scale{ border-left:1px #83BBD9 solid; border-right:1px red solid; width:200px; height:10px; position:relative; font-size:0px; } .scale div{ width:0px; position:absolute; width:0; left:0; height:5px; bottom:0; } li{ font-size:12px; line-height:50px; position:relative; height:50px; list-style:none; } </style> </head> <body> <ul> <li>爱情 <span id="title">0</span> <div class="scale_panel"> <span class="r">100</span>0 <div class="scale" id="bar"> <div></div> <span id="btn"></span> </div> </div> </li> <li>事业 <span id="title2">0</span> <div class="scale_panel"> <span class="r">100</span>0 <div class="scale" id="bar2"> <div></div> <span id="btn2"></span> </div> </div> </li> <li>家庭 <span id="title3">0</span> <div class="scale_panel"> <span class="r">100</span>0 <div class="scale" id="bar3"> <div></div> <span id="btn3"></span> </div> </div> </li> </ul> </body> <script> scale=function (btn,bar,title){ this.btn=document.getElementById(btn); this.bar=document.getElementById(bar); this.title=document.getElementById(title); this.step=this.bar.getElementsByTagName("DIV")[0]; this.init(); }; scale.prototype={ init:function (){ var f=this,g=document,b=window,m=Math; f.btn.onmou<a href="https://www.jb51.net/article/1141.html" target="_blank" class="infotextkey">sed</a>own=function (e){ var x=(e||b.event).clientX; var l=this.offsetLeft; var max=f.bar.offsetWidth-this.offsetWidth; g.onmousemove=function (e){ var thisX=(e||b.event).clientX; var to=m.min(max,m.max(-2,l+(thisX-x))); f.btn.style.left=to+'px'; f.ondrag(m.round(m.max(0,to/max)*100),to); b.getSelection ? b.getSelection().removeAllRanges() : g.selection.empty(); }; g.onmouseup=new Function('this.onmousemove=null'); }; }, ondrag:function (pos,x){ this.step.style.width=Math.max(0,x)+'px'; this.title.innerHTML=pos+'%'; } } new scale('btn','bar','title'); new scale('btn2','bar2','title2'); new scale('btn3','bar3','title3'); </script> <br /> </html>
以上所述是小编给大家介绍的JS实现拖动滚动条评分的效果代码分享,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com
暂无评论...
稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!
昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。
这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。
而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?
更新日志
2024年09月24日
2024年09月24日
- Mozart--ArthurGrumiaux(2024)[24BT]WAV
- 国风大师纯音系列《付娜广粤古筝》1CD[MP3][364.4MB]
- 国风大师纯音系列《罗晶-古筝情缘》1CD[MP3][75.1MB]
- 国风大师纯音系列《民乐琴王童丽-与古筝的约会》1CD[MP3][166.4MB]
- 刘美君.1993-被你纵坏【SONY】【WAV+CUE】
- 黄鹤翔.1998-爱的咏叹调【中唱】【WAV+CUE】
- 薰妮.1983-梦+淡(2000年永恒真存双碟版)【永恒】【WAV+CUE】
- 方伊琪.1976-时光消逝(2015复黑限量版)【风行】【WAV+CUE】
- 群星.1990-宝丽金影视金曲巡礼【宝丽金】【WAV+CUE】
- 林俊杰.2014-新地球(精装预售“光”版)【华纳】【WAV+CUE】
- 国风大师纯音系列《王珣学院派独特的空灵古筝》1CD[FLAC][888MB]
- 国风大师纯音系列《古筝演奏家 付娜》1CD[FLAC][1.2GB]
- 国风大师纯音系列《古筝仙子 常静演奏 十指弹一》1CD[FLAC][919MB]
- DasKapital-OneMustHaveChaosInsidetoGiveBirthtoaDancingStar(2024)[24-44.1]WAV
- 王菲.1999-《只爱陌生人》日本东芝版[低速原抓WAV+CUE]