Click here to Skip to main content
6,933,325 members and growing! (13,605 online)
Email Password   helpLost your password?
 
Web Development » Client side scripting » Controls     Intermediate License: The Code Project Open License (CPOL)

FTab (Floating Tabs)

By uuware

FTab (Floating Tabs) is a cool cross browser DHTML floating window script with support for tabs.
Javascript, CSS, HTML, XHTML, Windows, Linux, WebForms, Ajax, Dev
Revision:4 (See All)
Posted:12 Jun 2009
Updated:29 Sep 2009
Views:13,575
Bookmarked:44 times
printPrint Friendly   add Share
      Discuss Discuss   Broken Article?Report  
20 votes for this article.
Popularity: 6.13 Rating: 4.71 out of 5

1

2
2 votes, 10.0%
3
1 vote, 5.0%
4
17 votes, 85.0%
5

Introduction

FTab (Floating Tabs) is a COOL cross browser DHTML floating window script with support for tabs. The floating window can move/resize/minimize/maximize/fixed/show modal, and the states(size/positions/minimized/maximized or others) can save to cookie. It's so easy to configure that you only need put your content into separate tabs and then call:

FTab('ftab1',left, top, width, height, style)

A COOL floating window with tabs will be shown! You can also create a window without floating. Open the example page to see how COOL FTab is!
Supports a wide variety of browsers such as Internet Explorer, Opera, Firefox, Google Chrome and Safari.

Using the Code

A simple code is shown here. For full features, see the demo page.

  1. Add this in the head:
    <link rel="stylesheet" href="ftab.css">
    <script type="text/javascript" src="ftab.js"></script>
  2. Add contents in the body:
    <!-- FTabMain START --> 
    <div id="ftab1" title="ftab1's title" style="display:none;"> 
    
    <!-- FTabPage START --> 
    <div title="Page1"> 
    page1<br> 
    </div> 
    <!-- FTabPage END --> 
    <!-- FTabPage START --> 
    <div title="Page1"> 
    page1<br> 
    </div> 
    <!-- FTabPage END --> 
    
    </div> 
    <!-- FTabMain END --> 
  3. After contents, add JavaScript to initialize FTab:
    <script type="text/javascript"> 
    FTab('ftab1',330,90,160,50,''); 
    </script>

Points of Interest

  1. Params for initializing FTab:
    function FTab(tabID, left, top, width, height, style, showPageIndex)

    can be used like: (notice no 'new' as var o = new FTab(...), but no errors even if you use 'new'.)

    var o = FTab(tabID,10,10,200,160, 
      'title:1;minmax:1;close:1;move:1;status:1;resize:1;scroll:1;tab:1;',0);
      o.show(pageIndex);

    As options, here are all (1 for default true):

    title:1;minmax:1;close:1;move:1;status:1;resize:1;scroll:1;tab:1;
      tabrect:1;expandable:0;cookie:1;modal:0;center:0;

    It can also be like this:

    FTab(tabID,10,10,200,160,'').show(pageIndex);

    When creating FTab, you need these params (left, top, and others), but next time, you only need tabID to refer to FTab.
    For styles, default of all params is 1. If no title(title:0), then no close and minmax buttons even set them as 1, and also no moving. If there is no status (status:0), then there is no resize.
    If set 'expandable:1;' (default is 0), then auto set this style:

    noTitle = false;
    noResize = true;
    noMinMax = true;
    noClose = true;
    noMove = true;
    noStatus = true;
    noFixed = true;
    modal = false;
    center = false;
  2. After initializing, you can use these functions:
    function show(pageIndex);
    function switchMinMax();
    function switchFixed();
    function hide();
    function setTitle(str);
    function setTabTitle(pageIndex, str);
    function setBody(pageIndex, str);
    function setURL(pageIndex, url);
    function setStatus(str);
    function getSelectedIndex();
    function isHide();
    function isMin();
    function isFixed();
    function move(left, top, width, height);
  3. Support for user's event:
    Here you can do something if you like.
    FTabs.OnPageShow = function(ftab,index) 
    { 
      window.status='FTab_OnPageShow,window:'+ftab.id + ', 
    	index:' + index + ' is shown.'; 
    } 
    FTabs.OnActing = function(ftab) 
    { 
      window.status='FTab_OnActing,window:'+ftab.id + '.'; 
    } 
    FTabs.OnDeActing = function(ftab) 
    { 
      window.status='FTab_OnDeActing,window:'+ftab.id + '.'; 
    } 
    FTabs.OnMinMax = function(ftab, isMin) 
    { 
      window.status='FTab_OnMinMax,window:'+ftab.id + ', isMin:' + isMin; 
    } 
    FTabs.OnHide = function(ftab) 
    { 
      window.status='FTab_OnHide,window:'+ftab.id + '.'; 
    } 

Extend Style

  • Customized for user
  • Can set other colors or styles

Click "ExtStyle" buttons in the example page.

History

  • First released on 2008/07/08
  • Updated on 2008/8/22 - Added expandable style
  • Updated on 2009/6/07 - JS source is compressed added to only 11 KB!
  • Updated on 2009/6/21 - Added fixed and modal dialog features.

For details, visit last version & demo.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

uuware


Member
From china, and location at japan.
Occupation: Software Developer
Location: China China

Other popular Client side scripting articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 30 (Total in Forum: 30) (Refresh)FirstPrevNext
GeneralDemo PinmemberJohnny J.21:32 30 Sep '09  
GeneralRe: Demo Pinmemberuuware15:56 1 Oct '09  
GeneralRe: Demo PinmemberJohnny J.20:04 1 Oct '09  
GeneralRe: Demo Pinmemberuuware20:25 1 Oct '09  
GeneralRe: Demo Pinmemberac-chan12:48 9 Oct '09  
GeneralRe: Demo Pinmemberuuware15:47 12 Oct '09  
GeneralVery Nice Work PinmvpAbhijit Jana11:53 29 Sep '09  
JokeRe: Very Nice Work [modified] Pinmemberuuware15:40 29 Sep '09  
GeneralOf browser compatibility ... PinmemberMember 33441294:45 4 Jul '09  
GeneralRe: Of browser compatibility ... Pinmemberuuware16:20 5 Jul '09  
GeneralRe: Of browser compatibility ... PinmemberMember 33441291:10 6 Jul '09  
GeneralRe: Of browser compatibility ... Pinmemberuuware1:37 6 Jul '09  
I think you need refresh your Opera.
I test again in demo page and also js_ftab_en.htm,i can move it.
(Now I am redirect my site from google's app to webhostingpad,perhaps you need wait for a while,I will update codeproject soon.)
At line 679 of ftab_src.js, should be:
if(window.getSelection) window.getSelection().removeAllRanges();
else if(document.selection && document.selection.empty) document.selection.empty();
Thank you.
GeneralRe: Of browser compatibility ... PinmemberMember 334412914:30 6 Jul '09  
GeneralRe: Of browser compatibility ... Pinmemberuuware15:46 6 Jul '09  
GeneralBrowser Back Button Pinmembercwlocke11:08 25 Jun '09  
GeneralRe: Browser Back Button Pinmemberuuware19:01 30 Jun '09  
GeneralVery nice PinmemberJimmiepotter9:30 24 Jun '09  
JokeRe: Very nice Pinmemberuuware12:46 24 Jun '09  
GeneralWow very nice Pinmemberaldo hexosa1:19 17 Jun '09  
JokeRe: Wow very nice Pinmemberuuware5:29 17 Jun '09  
GeneralThis looks very nice PinmemberPaul Darlington22:15 15 Jun '09  
GeneralRe: This looks very nice Pinmemberuuware4:15 16 Jun '09  
Generalthanks ! PinmemberBillWoodruff9:52 15 Jun '09  
GeneralRe: thanks ! Pinmemberuuware17:23 15 Jun '09  
GeneralRe: thanks ! PinmemberBillWoodruff19:35 15 Jun '09  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+PgUp/PgDown to switch pages.

PermaLink | Privacy | Terms of Use
Last Updated: 29 Sep 2009
Editor: Deeksha Shenoy
Copyright 2009 by uuware
Everything else Copyright © CodeProject, 1999-2010
Web18 | Advertise on the Code Project