Coder Social home page Coder Social logo

99points / facebook-reactions-js Goto Github PK

View Code? Open in Web Editor NEW
47.0 47.0 13.0 164 KB

A simple & easy solution to add Facebook style "Like" button with reactions.

Home Page: http://www.99points.info/plugins/Facebook-Style-Reactions-JS/

JavaScript 39.32% CSS 21.70% PHP 0.15% Hack 38.82%
facebook facebook-reactions jquery-plugin

facebook-reactions-js's People

Contributors

99points avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

facebook-reactions-js's Issues

Multiple click fix

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'));

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.