JQuery - twarda spacja - SIEROTKI (automatycznie)

<script type="text/javascript">
(function($){
    $.fn.removeOrphans = function(){
        if($(this).length > 0) {
            var $html = $(this).html();
            $html = $html.replace(/(\s)([\S])[\s]+/g, "$1$2&nbsp;");
            // stosując wyrażenie regularne, do każdej pojedyńczej litery
            // posiadającej z obu stron spacje, dodajemy encje &nbsp;,
            // czyli popularną "twardą spację"
             $(this).empty().html($html);
        }
    }
})(jQuery);
$(document).ready(function(){
        $('#tresc').removeOrphans();    // <- 1 DIV
        $('#tresc1, #tresc2, #tresc3').removeOrphans();  // <- Wiele DIV
    });
</script>

Brak komentarzy:

Prześlij komentarz

LinkWithin-4

Related Posts Plugin for WordPress, Blogger...