希望文字超出div 範圍時自動截斷


js code:

(function($){
                $.fn.extend({
                    //plugin name - animatemenu
                    animateMenu: function(options) {
           
                        //Settings list and the default values
                        var defaults = {
                            animatePadding: 60,
                            defaultPadding: 10,
                            evenColor: '#ccc',
                            oddColor: '#eee'
                        };
                       
                        var options = $.extend(defaults, options);
                   
                        return this.each(function() {
                            var o =options;
                           
                            //Assign current element to variable, in this case is UL element
                            var obj = $(this);            
                           
                            //Get all LI in the UL
                            var items = $("li", obj);
                             
                            //Change the color according to odd and even rows
                            $("li:even", obj).css('background-color', o.evenColor);            
                            $("li:odd", obj).css('background-color', o.oddColor);                    
                            items.css({paddingLeft: o.defaultPadding});
                            //Attach mouseover and mouseout event to the LI
                            items.mouseover(function() {
                                $(this).animate({paddingLeft: o.animatePadding}, 300);
                               
                            }).mouseout(function() {
                                $(this).animate({paddingLeft: o.defaultPadding}, 300);
                            });
                           
                        });
                    }
                });
            })(jQuery);


html code:

<div class="tagtoo-buy-side-title multiline" style="width: 100%; height: 15px; margin-top: 3px; overflow: hidden"> 寵愛之名 極致奢華雙星(買白松露送水凝霜) 寵愛之名 極致奢華雙星</div>

留言

熱門文章