Giter Club home page Giter Club logo

facebook-reactions-js's Introduction

Facebook Style Reactions Plugin

gif

Developed by: Zeeshan Rasool (Founder at http://www.99points.info & PHPWallScript)

About The Plugin

This plugin allows you to generate a like button similar in Facebook style with option to select different reactions from the list. i-e Like, haha, sad, wow etc.

With very simple HTML you can convert the simple button to an interactive facebook style reaction button which will submit the selection a user will made back to the database.

Demo

See the examples here.

How To Use

The button HTML will look like this:



<a class="FB_reactions" data-reactions-type='horizontal' data-unique-id="1" data-emoji-class="">
	<span>Like</span>
</a>

we can change the default button text which is LIKE in this case to anything you want. The class name FB_reactions is also changable as long as the same names in the css are also updated. data-reactions-type='horizontal', data-unique-id="1" and data-emoji-class="" are required though.

In above, you can change data-reactions-type='horizontal' to data-reactions-type='vertical' to change the reaction popup position from horizontal to vertical.

data-unique-id="1" is the control ID which we will assign to each button so we should be able to know which button is clicked. This is for backend purpose where we need to know against which button/control we have to store the reaction selected by any user. So either this can be a unique random number for all controls on same page or we can assign some unique IDs etc.

data-emoji-class will be used to set default class when the page will be loaded. It can have any of these classes like, love, haha, wow, sad, angry. If we will leave it empty, it will be considered "like" by default.

Example to make "Wow" selected by default:

<a class="FB_reactions" data-reactions-type='vertical' data-unique-id="1" data-emoji-class="wow">   
	<span> WOW </span>
</a>

To initiate the reactions:

$('.FB_reactions').facebookReactions();

Parameters:

We have three types of required data attributes:

Data Attributes

data-reactions-type: horizontal and vertical

data-unique-id: Any uniqe number or ID for each instance on same page.

data-emoji-class: like, love, haha, wow, sad, angry

Passing the callback URL:


$('.FB_reactions').facebookReactions({
	postUrl: "save.php"
});

Once any user will chose a reaction, the ajax call will be made to save the selection of that button. Here the Ajax call will automatically pass the selection and control ID as POST params to save.php

License

Copyright (c) 2017 Zeeshan Rasool, http://wallscriptclone.com/ & http://www.99points.info

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 


facebook-reactions-js's People

Contributors

99points avatar

Watchers

James Cloos avatar

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.