EasyUI Forum
December 20, 2025, 09:29:54 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to style tab header?  (Read 12288 times)
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« on: June 20, 2016, 09:21:00 PM »

How to style tab header?

For example i have 4 tabs, and i want to make:
tab 1 have small tab header size
tab 2 have yellow background in tab header
tab 3 have normal tab header size
tab 4 have big tab header size with green background

or see the image below


How to do that?

thank you in advance
« Last Edit: June 20, 2016, 09:24:30 PM by aswzen » Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
jarry
Administrator
Hero Member
*****
Posts: 2305


View Profile Email
« Reply #1 on: June 21, 2016, 12:06:56 AM »

Here is the extended method 'setTabStyle' that allows you to set the styles for a special tab strip.
Code:
<script type="text/javascript">
    $.extend($.fn.tabs.methods, {
        setTabStyle: function(jq, param){
            return jq.each(function(){
                var opts = $(this).tabs('options');
                var tab = $(this).tabs('getTab', param.which).panel('options').tab.find('.tabs-inner');
                tab.css(param);
                tab._outerHeight(param.height);
                var margin = opts.tabHeight-param.height;
                tab.css({
                    lineHeight:tab[0].style.height,
                    marginTop:(opts.tabPosition=='top'?margin+'px':0),
                    marginBottom:(opts.tabPosition=='bottom'?margin+'px':0)
                });
            });
        }
    });
    $(function(){
        $('#tt').tabs({
            narrow:true,
            plain:true,
            tabHeight:60
        });
        $('#tt').tabs('setTabStyle', {which:0,height:30});
        $('#tt').tabs('setTabStyle', {which:1,height:40,background:'yellow'});
        $('#tt').tabs('setTabStyle', {which:2,height:40});
        $('#tt').tabs('setTabStyle', {which:3,height:60,background:'green',color:'#fff'});
    })
</script>
Logged
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« Reply #2 on: June 21, 2016, 08:04:17 PM »

wow its worked
thank you Smiley

http://jsfiddle.net/aswzen/u5yeneug/
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!