Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    78
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Question Ellipsis not working in blackberry os 5

    .ellipsis {
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    }

    What would be the solution/alternative to this.?

    Thanks in advance

  • #2
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    The alternative is using jQuery.

    http://caniuse.com/text-overflow

    According caniuse statistics, text-overflow will work 92.8% of the time (for Blackberry 7+). Quite honestly, I would call it a day and not use jQuery.

    Pulled off of a Google search, here's the jQuery alternative:

    Code:
    <div class="ellipsis"></div>
    Code:
    <script type="text/javascript" src="/js/jquery.ellipsis.js"></script>
    <script type="text/javascript">
    $(".ellipsis").ellipsis();
    </script>
    jquery.ellipsis.js:
    Code:
    (function($) {
            $.fn.ellipsis = function()
            {
                    return this.each(function()
                    {
                            var el = $(this);
    
                            if(el.css("overflow") == "hidden")
                            {
                                    var text = el.html();
                                    var multiline = el.hasClass('multiline');
                                    var t = $(this.cloneNode(true))
                                            .hide()
                                            .css('position', 'absolute')
                                            .css('overflow', 'visible')
                                            .width(multiline ? el.width() : 'auto')
                                            .height(multiline ? 'auto' : el.height())
                                            ;
    
                                    el.after(t);
    
                                    function height() { return t.height() > el.height(); };
                                    function width() { return t.width() > el.width(); };
    
                                    var func = multiline ? height : width;
    
                                    while (text.length > 0 && func())
                                    {
                                            text = text.substr(0, text.length - 1);
                                            t.html(text + "...");
                                    }
    
                                    el.html(t.html());
                                    t.remove();
                            }
                    });
            };
    })(jQuery);
    Last edited by Sammy12; 09-18-2012 at 09:56 AM.

  • #3
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,925
    Thanks
    6
    Thanked 1,040 Times in 1,013 Posts
    If you’re not already using jQuery for something else then this would a lot of overhead code to load for such a minor feature. This can probably be replicated with about the same amount of code as in the plugin but without the ~32KB jQuery library using plain JavaScript (although I honestly wouldn’t know how to do it; the folks at the JS forum might be able to tell).

  • #4
    New Coder
    Join Date
    Feb 2007
    Posts
    78
    Thanks
    8
    Thanked 0 Times in 0 Posts
    we are not using jquery in our application.We are using javascript


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •