Monday, 16 September 2013

Tooltip script function

<script>
function refreshTooltip() {
    $('.tooltip-questionmark').tooltip({
        position: {
            my: "center bottom-20",
            at: "center top",
            using: function( position, feedback ) {
                $( this ).css( position );
                $( "<div>" )
                    .addClass( "arrow" )
                    .addClass( feedback.vertical )
                    .addClass( feedback.horizontal )
                    .appendTo( this );
            }
        }
    });
    $('.tooltip-pageyourself').tooltip({
        content: function () {
            return $(this).prop('title');
        },
        position: {
            my: "center bottom-20",
            at: "center top",
            using: function( position, feedback ) {
                $( this ).css( position );
                $( "<div>" )
                    .addClass( "arrow" )
                    .addClass( feedback.vertical )
                    .addClass( feedback.horizontal )
                    .appendTo( this );
            }
        }
    });
};
$(document).ready(function() {
    refreshTooltip();
    // Init placeholder function for browser that doesn't support it
    $('[placeholder]').defaultValue();
});
</script>

No comments:

Post a Comment