diff --git a/index.html b/index.html
index dc76104..9cfbe1e 100644
--- a/index.html
+++ b/index.html
@@ -16,7 +16,7 @@
alert(element.id + " - " + value)
},
labelTemplate: "#{rate} #{text}",
- resetDelay: 1
+ resetDelay: 0.1
});
});
@@ -27,11 +27,13 @@
Songs
diff --git a/javascripts/rating.js b/javascripts/rating.js
index 263ba76..84d418e 100644
--- a/javascripts/rating.js
+++ b/javascripts/rating.js
@@ -42,12 +42,13 @@ var Ratable = Class.create({
initialize: function(element) {
this.element = element;
+ this.starsContainer = this.element.down('.stars');
this.options = Object.extend({
onRate: Prototype.emptyFunction,
labelClassName: 'label',
labelValues: ['bad', 'not bad', 'good', 'very good', 'excellent'],
labelTemplate: "#{text}",
- resetDelay: 0.2
+ resetDelay: 0.0
}, arguments[1] || {});
this.stars = new Array();
this.resettingTimeout = null;
@@ -60,9 +61,9 @@ var Ratable = Class.create({
this.element.select('.star').each(function(element) {
this.stars.push(new RatingStar(element, this));
}.bind(this));
- this.element.observe('mouseover', this.handleMouseOver.bind(this));
- this.element.observe('mouseout', this.handleMouseOut.bind(this));
- this.element.observe('click', this.handleClick.bind(this));
+ this.starsContainer.observe('mouseover', this.handleMouseOver.bind(this));
+ this.starsContainer.observe('mouseout', this.handleMouseOut.bind(this));
+ this.starsContainer.observe('click', this.handleClick.bind(this));
},
reset: function() {
@@ -139,7 +140,6 @@ var Rating = Class.create({
setup: function() {
$$('.' + this.options.className).each(function(element) {
- alert(element.id)
new Ratable(element, this.options);
}.bind(this));
}
diff --git a/stylesheets/rating.css b/stylesheets/rating.css
index 3e8f79e..6ecb499 100644
--- a/stylesheets/rating.css
+++ b/stylesheets/rating.css
@@ -1,18 +1,19 @@
-.rating {
+.rating .stars {
width: 50px;
height: 9px;
+ float: left;
}
-.rating .star {
+.rating .stars .star {
width: 10px;
height: 9px;
cursor: pointer;
background: transparent url('../images/stars.png') no-repeat 0 0;
float: left;
}
-.rating .star.on {
+.rating .stars .star.on {
background-position: 0 -9px;
}
-.rating.selected .star.on {
+.rating.selected .stars .star.on {
background-position: 0 -18px;
}
\ No newline at end of file