Skip to content

Instantly share code, notes, and snippets.

@vgheri
Created June 4, 2012 17:49
Show Gist options
  • Save vgheri/2869813 to your computer and use it in GitHub Desktop.
Save vgheri/2869813 to your computer and use it in GitHub Desktop.
plugin
$.fn.iLikeIt = function (options) {
var div = createVotingDiv();
// element is the carousel
var element = $(this);
element.append(div);
element.carousel({
interval: false,
pause: "hover"
});
element.carousel('pause');
$(".carousel-vote").on("mouseenter", function () {
preloadRating();
});
$(".vote-item").on("mouseover", "img", function () {
var elem = $(this);
displayRating(elem.attr("id"), true);
});
$(".vote-item").on("mouseout", "img", function () {
var elem = $(this);
displayRating(elem.attr("id"), false);
});
$(".vote-item").on("click", "img", function () {
var elem = $(this);
registerVote(elem, options.postUrl);
});
return this; //allow chaining
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment