99points / facebook-reactions-js Goto Github PK
View Code? Open in Web Editor NEWA simple & easy solution to add Facebook style "Like" button with reactions.
Home Page: http://www.99points.info/plugins/Facebook-Style-Reactions-JS/
A simple & easy solution to add Facebook style "Like" button with reactions.
Home Page: http://www.99points.info/plugins/Facebook-Style-Reactions-JS/
Suggestion.
Generally you a class selector which primes all the the elements with the class="FB_reactions"
j$('.FB_reactions').facebookReactions({
postUrl: "/react/add/"
});
However, if we want to call on multiple individual elements like this (You may want multiple calls if you are doing something like Infinite scroll, or maybe dynamically adding stuff). ie.
j$('#MyReaction').facebookReactions...
j$('#MyReaction2').facebookReactions...
It gets funky, and will make multiple onClick calls (and thus ajax posts) when select one of the emotes from the pop-up (actually the number will be the number of elements below it on the page).
So I made a small change
I changed this line
$('.emoji').on("click",function (e) {
to
$('.emoji').off("click").on("click",function (e) {
which just removes any click handler it may have set before adding new one
In addition, I didn't want to create the 'faces' div over again, so I added this:
let faceAdded=0; // stop extra appends
(function($) {
....
if (!faceAdded++) <--- added this
$(_react_html).appendTo($('body'));
can i use it without jquery ui
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.