js评价五星

1、图片(star.png):

2、图片和html文件在同级目录

<html>
<head>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('.difficulty i').click(function(){$(this).nextAll().removeClass('s');$(this).prevAll().addClass('s');$(this).addClass('s');});
$('.difficulty i').mouseenter(function(){$(this).nextAll().removeClass('h');$(this).prevUntil('.s').addClass('h');$(this).addClass('h');}).mouseleave(function(){$(this).siblings().removeClass('h');$(this).removeClass('h');});
});
</script>
<style type="text/css">
.difficulty { width:80px; height:14px; float:left; margin:7px 30px 0 0;}
.difficulty i{ width:15px; height:14px; float:left; background:url(star.png) no-repeat -30px 0; margin:0 1px 0 0; cursor:pointer;}
.difficulty i.h{ background:url(star.png) no-repeat -15px 0;}
.difficulty i.s{ background:url(star.png) no-repeat 0 0;}
</style>
</head> <body>
<div class="difficulty"><i></i> <i></i> <i></i> <i></i> <i></i></div>
</body> </html>

  

js评价五星的更多相关文章

  1. 超简单的js评价小星星

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  2. Node.js初探之hello world

    昨天公司内部培训,主讲人王老板对Node.js评价很高,连用几个“变态”来形容,恰好今天周末,有时间来认识下Node.js,对一门新语言最好的认识,是让其输出“hello world”,今天我就利用N ...

  3. nodebeginer

    最近对node开始感兴趣,知乎上朴灵推荐入门书籍,goddy翻译的node beginner. 貌似大家对深入浅出node.js评价都不错,以后可以考虑入手看看. 一口气看完了node beginne ...

  4. js 实现仿 淘宝 五星评价 demo

    <style> @font-face { font-family: 'iconfont'; /* project id 247957 */ src: url('//at.alicdn.co ...

  5. jquery 五星评价(图片实现)

    1111 <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <ti ...

  6. 五星评分效果 原生js

    五星评分在很多地方都可以用到,网上也有插件或者相应的代码,在这里我给大家提供一款我自己写的超级简单实用的五星评分代码,连图片都不需要 <!-- 评分start --> <ul> ...

  7. 前端js调用七牛制作评价页面案例

    一.需求 公司所有的上传页面都用七牛,前端不免要直接调用七牛的代码进行上传,以下是一个实现七牛上传的案例,制作一个常见的商品评价页面,页面需求很常见当上传到第五章图片的时候,上传按钮消失,上传需要显示 ...

  8. JS实现星级评价

    说明: 本方法采用了Jquery库,暂时检测兼容IE8版本.本示例的2种颜色的星星都是放入了一张png图片当中,当然还有其他的一些实现思路.本示例展示的情况是当前页面只有一个星级评价的情况. 思路: ...

  9. js五星好评

    一般我们在一些购物以及美食的网站都会看到五星好评之类的,一下是使用js制作的五星好评! <!DOCTYPE html> <html lang="en"> & ...

随机推荐

  1. Git客户端安装

    Git介绍 分布式 : Git版本控制系统是一个分布式的系统, 是用来保存工程源代码历史状态的命令行工具; 保存点 : Git的保存点可以追踪源码中的文件, 并能得到某一个时间点上的整个工程项目额状态 ...

  2. ES6学习笔记八:类与继承

    一:Class ES6 提供了更接近传统语言的写法,引入了 Class(类)这个概念,作为对象的模板.通过class关键字,可以定义类. 定义“类”的方法的时候,前面不需要加上function这个关键 ...

  3. JavaWeb应用项目部署到云ubuntu

    转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6383068.html 在前面的博文中,我们已经在云主机ubuntu上搭建好jdk.tomcat以及mysql了 ...

  4. Oracle列自增实现(3)-DEFAULT Values Using Sequences

    Oracle 12c中,可以使用序列的NEXTVAL and CURRVAL的值作为默认值,来实现列自增! 一.使用序列的NEXTVAL and CURRVAL的值作为默认值 创建序列 CREATE ...

  5. Windows Live Writer离线写CSDN博客

    初始化配置 http://blog.csdn.net/csdnproduct/article/details/27504397 代码着色功能插件: http://www.cnblogs.com/cmt ...

  6. 对2个hex(16进制)字符串进行异或操作

    private static String hexXOR(String hex1, String hex2){ BigInteger i1 = new BigInteger(hex1, 16); Bi ...

  7. C++ 的 runtime exception是没有扩展性的

    https://groups.google.com/forum/#!topic/seastar-dev/RuK-OajeqHk https://www.google.com/search?ei=gTH ...

  8. rhel7.x配置本地yum

    转载:http://www.mvpbang.com/articles/2017/12/22/1513948827684.html rhel7.x配置本地yum 环境: centos7.4 vmarew ...

  9. 【LeetCode】217. Contains Duplicate (2 solutions)

    Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your funct ...

  10. 【MySQL】MySQL支持的数据类型

    1.整型 MySQL数据类型 含义(有符号) tinyint(m) 1个字节 范围(-128~127) smallint(m) 2个字节 范围(-32768~32767) mediumint(m) 3 ...