jQuery动态星级评分效果实现方法
本文实例讲述了jQuery动态星级评分效果实现方法。分享给大家供大家参考。具体如下:
这里的jQuery星级评分代码,是大家都很喜欢的功能,目前广泛应用,本星级评分加入了动画效果,注意,如果要真正实现星级评分,你需要动态程序配合,如ASP/PHP等,以便将评分值存入数据库。
运行效果如下图所示:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>jquery超漂亮星级评分</title><script type="text/javascript" src="jquery-1.6.2.min.js"></script><style>.user_rate {font-size:14px; position:relative; padding:10px 0;}.user_rate p {margin:0; padding:0; display:inline; height:40px; overflow:hidden; position:absolute; top:0; left:100px; margin-left:140px;}.user_rate p span.s {font-size:36px; line-height:36px; float:left; font-weight:bold; color:#DD5400;}.user_rate p span.g {font-size:22px; display:block; float:left; color:#DD5400;}.big_rate_bak {width:140px; height:28px; text-align:left; position:absolute; top:3px; left:85px; display:inline-block; background:url(http://files.jb51.net/file_images/article/201508/201586174000242.gif) left bottom repeat-x;}.big_rate_bak b {display:inline-block; width:24px; height:28px; position:relative; z-index:1000; cursor:pointer; overflow:hidden;}.big_rate_up {width:140px; height:28px; position:absolute; top:0; left:0; background:url(http://files.jb51.net/file_images/article/201508/201586174000242.gif) left top;}</style></head><body><div class="user_rate"> <div class="big_rate_bak"> <b rate="2" onclick="javascript:up_rate(20);"> </b> <b rate="4" onclick="javascript:up_rate(40);"> </b> <b rate="6" onclick="javascript:up_rate(60);"> </b> <b rate="8" onclick="javascript:up_rate(80);"> </b> <b rate="10" onclick="javascript:up_rate(100);"> </b> <div style="width:45px;" class="big_rate_up"></div> </div> <p><span id="s" class="s"></span><span id="g" class="g"></span></p></div><br><br>如果运行错误请刷新页面即可~</body><script type="text/javascript">$(function(){ get_rate(88);})function get_rate(rate){ rate=rate.toString(); var s; var g; $("#g").show(); if (rate.length>=3){ s=10; g=0; $("#g").hide(); }else if(rate=="0"){ s=0; g=0; }else{ s=rate.substr(0,1); g=rate.substr(1,1); } $("#s").text(s); $("#g").text("."+ g); $(".big_rate_up").animate({width:(parseInt(s)+parseInt(g)/10) * 14,height:26},1000); $(".big_rate_bak b").each(function(){ $(this).mouseover(function(){ $(".big_rate_up").width($(this).attr("rate") * 14 ); $("#s").text($(this).attr("rate")); $("#g").text(""); }).click(function(){ $("#f").text($(this).attr("rate")); $("#my_rate").show(); }) }) $(".big_rate_bak").mouseout(function(){ $("#s").text(s); $("#g").text("."+ g); $(".big_rate_up").width((parseInt(s)+parseInt(g)/10) * 14); })}function up_rate(rate){ $(".big_rate_up").width("0"); get_rate(rate);}</script></html>jQuery动态星级评分效果实现方法的更多相关文章
- jquery swiper3自定义切换效果的方法
jquery swiper3自定义切换效果的方法 <pre> <div class="swiper-slide"> <div class=" ...
- 纯css实现星级评分效果
效果 效果图如下,纯css实现超酷炫的星级评分动画效果 实现思路 5个类型为radio的input,label标签修改样式背景图为星星 label标签给每个星星鼠标停留时加注名字 点击星星有放大旋 ...
- jQuery动态五星评分
效果 css .star ul, .star li { list-style: none; } .star { position: relative; width: 600px; height: 24 ...
- js实现星级评分效果(非常规5个li代码)
1. 前言 此方案受到JS单行写一个评级组件启发,自己写了一个简单Demo. 功能有正常滑动,动态显示实心星星个数:当点击确认,则保持当前的实心星星个数:再移动时未点击,则离开后还是保持之前的状态. ...
- [学习笔记]jQuery实现一些动画效果的方法
jQuery实现效果的方法 1,隐藏和显示:hide(),show(),toggle() // [ˈtɑ:gl]切换 语法: $(selector).hide(speed,callback); $( ...
- jquery实现星级评分
项目中遇到到实现星级评分,就用了这个插件 http://www.jq22.com/jquery-info291
- jQuery用户数字评分效果
效果预览:http://hovertree.com/texiao/jquery/5.htm HTML文件代码: <!DOCTYPE html> <html xmlns="h ...
- jQuery Raty 星级评分
在线实例 实例演示 使用方法 <div id="star"></div> 复制 $('#star').raty(); 复制 你只需要有一个 div构建Rat ...
- jquery动态加载JS【方法getScript】的改进
http://www.cnblogs.com/cuitsl/archive/2012/11/15/2771549.html
随机推荐
- Zabbix Server和MPM(monitor for mysql)的高速部署
1. 前言 zabbix作为开源免费的监控软件.其易于管理配置和可视化的视图.历史数据的定期维护.模板化的监控项目越来越受到广大IT运维人员的喜爱. 这里主要是总结了下Zabbix S ...
- 查看 apache、nginx、php、mysql 的编译参数
查看nginx编译参数:/usr/local/nginx/sbin/nginx -V 查看apache编译参数:cat /usr/local/apache2/build/config.nice 查看m ...
- 正则表达式总结 java 等
这个经常用的到,就来总结一下 #一下是JAVA中的正则表达式 在 JDK1.4 里有了自己的正则表达式 API 包,JAVA 程序员可以免去找第三方提供的正则表达式库的周折了,我们现在就马上来了解一下 ...
- easyui框架Date日期类型以json形式显示到前台datagrid时,显示为[object Object]
如下图,easyui当后台把时间数据返回转换成json然后加载在easyui的datagrid里面,显示为[object Object] 需要对时间格式添加格式的显示方法 /** * 时间格 ...
- IE提示console未定义问题解决
在页面加入如下代码: if (!window.console || !console.firebug){ var names = ["log", "debug&qu ...
- C# 中运行exe程序
private int runProcess(string fileName, string appParam) { int returnValue = -1; try { Process myPro ...
- Linux 设置IP,gate, 以及自动获取IP的方法
一.使用命令设置ubuntu的ip地址 1.修改配置文件blacklist.conf禁用IPV6: sudo vi /etc/modprobe.d/blacklist.conf 2.在文档最后添加 b ...
- Atitit.软件仪表盘(4)--db数据库子系统-监测
Atitit.软件仪表盘(4)--db数据库子系统-监测 连接数::: 死锁表列表:死锁基础列表(最近几条记录,时间,sql等) 3.对服务器进行监控,获取CUP,I/O使用情况 4.对数据库进行 ...
- [svc]C10K 问题引发的技术变革
C10K 问题引发的技术变革 http://rango.swoole.com/archives/381 C10K 问题 服务器应用领域很古老很出名的一个问题,大意是说单台服务器要同时支持并发 10K ...
- MongoDB 学习 第八节 驱动实践
作为系列的最后一篇,得要说说C#驱动对mongodb的操作,目前驱动有两种:官方驱动和samus驱动,不过我个人还是喜欢后者, 因为提供了丰富的linq操作,相当方便. 官方驱动:https://gi ...