JSFiddle - React, Tailwind, and code Playground

by prasad raja

HTML

<ul>
            <li><a class="userHoverCard hc-name" data-hovercard="/hovercardTest.aspx/LoadUser"
                data-hovercardid="1" href="/hovercardTest.aspx?g=1">User 1</a> </li>
                </ul>
                http://kevin-junghans.blogspot.com/2013/12/using-claims-in-aspnet-identity.html
                
                  [WebMethod]
        public static object LoadUser(string id)
        {
            var obj = new
            {
                name = "prasad",
                age = "21",
                joined = string.Format("{0: MMMM dd, yyyy}", DateTime.Now),
                role = "Dealer",
                avatar = "/content/noavatar.gif",
                refirectprofile = "/user/" + id,
                online = true,
                usertype = "34",
                newlead = 10,
                ongoing = 20,
                completed = 10,
                total = 25,
                email = "",
                location = "Chennai, Tamil Nadi, India"
            };
            return obj;
        }

CSS

.hc-preview
{
    position: relative;
    display: inline;
}

.hc-name
{
    position: relative;
    display: inline-block !important;
    float: none !important;
    cursor: pointer;
    z-index: 50;
}

.hc-details
{
    left: -10px;
    top: -10px;
    margin-right: 80px;
    text-align: left;
    font-family: Sans-serif !important;
    font-size: 12px !important;
    color: #666 !important;
    line-height: 1.5em;
    position: absolute;
    padding: 2em 10px 10px;
    display: none;
    -moz-box-shadow: rgba(42, 73, 133, 0.4) 0 4px 12px 0, rgba(255, 255, 255, 0.506) 0 1px 0 0 inset;
    -webkit-box-shadow: rgba(42, 73, 133, 0.4) 0 4px 12px 0, rgba(255, 255, 255, 0.506) 0 1px 0 0 inset;
    box-shadow: rgba(42, 73, 133, 0.4) 0 4px 12px 0, rgba(255, 255, 255, 0.506) 0 1px 0 0 inset;
    border: solid 1px #aaa;
    z-index: 100;border-radius:5px;
}
.pull-right{float:right;}
.hc-details .s-action
{
    position: absolute;
    top: 5px;
    right: 20px;
}
.hc-details .s-close
{
    position: absolute;
    top: 11px;
    right: 8px;
    background: url("/content/closelabel.png") no-repeat;
    width: 8px;
    height: 8px;cursor:pointer;
}
.hc-details .s-close:hover
{
    cursor: hand;
}
.hc-details .s-card-pad
{
    border-top: solid 1px #eee;
    margin-top: 10px;
    padding-top: 10px;
    overflow: hidden;
}
.hc-details .s-card .s-strong
{
    font-weight: bold;
    color: #555;
}
.hc-details .s-img
{
    float: left;
    margin-right: 10px;
    max-width: 70px;
}
.hc-details .s-name
{
    color: #222;
    font-weight: bold;
}
.hc-details .s-href
{
    clear: both;
    float: left;
}
.hc-details .s-username
{
    text-decoration: none;
}
.hc-details .s-stats
{
    display: block;
    float: left;
    margin-top: 5px;
    clear: both;
    padding: 0;
}
.hc-details ul.s-stats li
{
    list-style: none;
    float: left;
    display: block;
    padding: 0px 10px !important;
    margin: 0;
    border-left: solid 1px #eaeaea;
}
.hc-details ul.s-stats li:first-child
{
...

JavaScript

$(function () {
        $('.hc-name').hovercard({
            showCustomCard: true
        });
    });
    
//Title: Hovercard plugin by PC 
//Documentation: http://designwithpc.com/Plugins/Hovercard
//Author: PC 
//Website: http://designwithpc.com
//Twitter: @chaudharyp

(function ($) {
    $.fn.hovercard = function (options) {

        //Set defauls for the control
        var defaults = {
            width: 300,
            openOnLeft: false,
            openOnTop: false,
            cardImgSrc: "",
            detailsHTML: "",
            loadingHTML: "Loading...",
            errorHTML: "Sorry, no data found.",
            twitterURL: "",
            twitterScreenName: '',
            showTwitterCard: false,
            showYafCard: false,
            facebookUserName: '',
            showFacebookCard: false,
            showCustomCard: false,
            customCardJSON: {},
            customDataUrl: '',
            background: "#ffffff",
            delay: 0,
            autoAdjust: true,
            onHoverIn: function () {
            },
            onHoverOut: function () {
            }
        };

        //Update unset options with defaults if needed
        options = $.extend(defaults, options); //Executing functionality on all selected elements
        return this.each(function () {
            var obj = $(this).eq(0);
            //wrap a parent span to the selected element
            obj.wrap('<div class="hc-preview" />');

            //add a relatively positioned class to the selected element
            obj.addClass("hc-name");

            //if card image src provided then generate the image elementk
            var hcImg = '';
            if (options.cardImgSrc.length > 0) {
                hcImg = '<img class="hc-pic" src="' + options.cardImgSrc + '" />';
            }

            //generate details span with html provided by the user
            var hcDetails = '<div class="hc-details ui-widget ui-widget-content ui-corner-all" >' + hcImg...