Jump to content

clippy.js

javascript jquery js clippy

  • Please log in to reply
1 reply to this topic

#1 Guest_ElatedOwl_*

Guest_ElatedOwl_*
  • Guests

Posted 21 December 2012 - 03:19 PM

Posted Image
Friday before a long weekend at work, figured I'd draw up something fun.

jsFiddle

Called via
jQuery.clippy('caption here');


(function($){
    var bubble = {
        bottom: 0,
        left: 75,
        position: 'absolute',
        'border-width': '20px 0 0 20px',
        'border-style': 'solid',
        'border-color': 'black transparent'
    };
    var bubbleFill = {
        bottom: 2,
        left: 74,
        position: 'absolute',
        'border-width': '20px 0 0 20px',
        'border-style': 'solid',
        'border-color': '#FFFFCA transparent'
    };
    $.clippy = function(caption)
    {
        create(caption);
    };

    function create(text)
    {
        var clip = $('<div id="clippy" style="text-align: center"><div style="position: relative"><p>' + text + '</p><div class="bubble"></div><div class="bubbleFill"></div></div><img src="http://i.imgur.com/fwL6g.png"></div>');
        clip.css({
            position: 'fixed',
            bottom: '10px',
            left: '10px'
        });
        clip.find('p').css({
            'border-radius': '4px',
            background: '#FFFFCA',
            border: 'solid 1px black',
            display: 'inline-block',
            padding: '8px',
            'margin-bottom': '20px',
            'font-family': 'Arial',
            'font-size': '12px',
            'text-align': 'left',
            'max-width': '200px'
        });
        clip.find('.bubble').css(bubble);
        clip.find('.bubbleFill').css(bubbleFill);
        $('body').append(clip);
    }
})(jQuery);



#2 SpleenBeGone

SpleenBeGone

    Deer Leader of the Goriest Revolution

  • Administrators
  • 14,951 posts
  • LocationHouston

Posted 22 December 2012 - 08:18 AM

That's more interesting than it should be. >.>
nmjUGDL.jpg





Also tagged with one or more of these keywords: javascript, jquery, js, clippy