Ignore:
Timestamp:
Aug 22, 2011, 11:25:22 PM (13 years ago)
Author:
Zaphod
Message:

version 1.4.4 : new option to select default tab to be displayed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/stripped/js/scripts-tpp.js

    r9960 r11982  
    5757
    5858        var tab_loaded=0;
    59         var tab_height=[];
    6059        var delay=400;
    6160        var hfirst;
     
    6463        var tab_titles=jQuery(".tabTitle");
    6564        var tab_blocks=jQuery(".tabBlock");
     65        var tab_name;
     66        var tab_start = null;
     67       
     68        if (options.defaultTab) {
     69                if (options.defaultTab != "none") tab_start = options.defaultTab;
     70                if (options.defaultTab == "last") tab_start = jQuery.cookie("tabactive");
     71        }
    6672
    6773        if ((tab_titles.length != 0) && (tab_titles.length == tab_blocks.length)) {
     74
     75                if (tab_start != null) {
     76                        tab_blocks.each(function(index) {
     77                                jQuery(this).css("display","none");
     78                        });
     79                        tab_loaded=1;
     80                        jQuery("#tabs").css("height","auto");
     81       
     82                        tab_titles.each(function(index1) {
     83                                tab_name = jQuery(this).attr("name");
     84                                if (tab_name == tab_start) {
     85                                        jQuery(this).addClass("tabSelected");
     86                                        jQuery.cookie("tabactive",jQuery(this).attr("name"));
     87                                        var old_selected_tab =-1;
     88                                        tab_blocks.each(function(index2) {
     89                                                if (index1 == index2) {
     90                                                        jQuery(this).show();
     91                                                }
     92                                        });
     93                                }
     94                        });
     95               
     96                }
     97
    6898                tab_titles.each(function(index1) {
    6999                        var tab_title = jQuery(this);
     
    85115                                                }
    86116                                        });
     117                                        jQuery.cookie("tabactive",null);
    87118                                } else {
    88119                                        jQuery(this).addClass("tabSelected");
     120                                        jQuery.cookie("tabactive",jQuery(this).attr("name"));
    89121                                        var old_selected_tab =-1;
    90122                                        tab_titles.each(function(index2) {
     
    184216
    185217                        if (TitleBox.length != 0) {
    186                                 TitleBox.css("width",jQuery("#theImg").outerWidth()+"px");
     218                                TitleBox.css("min-width",jQuery("#theImg").outerWidth()+"px");
    187219                        }
    188220
     
    222254
    223255                if ((jQuery("#mapPicture").length==0) && (jQuery("#Panorama").length==0) && (jQuery("#pamoorama").length==0)){
    224                         PrevBoxIn.mouseenter(function(){PrevImg.animate({opacity:1},tfade);});
    225                         PrevBoxOut.mouseleave(function(){PrevImg.animate({opacity:0},tfade);});
     256                        PrevBoxIn.mouseenter(function(){PrevImg.stop(true, false).animate({opacity:1},tfade);});
     257                        PrevBoxOut.mouseleave(function(){PrevImg.stop(true, false).animate({opacity:0},tfade);});
    226258                } else {
    227259                        PrevBoxOut.css("display","none");
     
    237269
    238270                if ((jQuery("#mapPicture").length==0) && (jQuery("#Panorama").length==0) && (jQuery("#pamoorama").length==0)){
    239                         NextBoxIn.mouseenter(function(){NextImg.animate({opacity:1},tfade);});
    240                         NextBoxOut.mouseleave(function(){NextImg.animate({opacity:0},tfade);});
     271                        NextBoxIn.mouseenter(function(){NextImg.stop(true, false).animate({opacity:1},tfade);});
     272                        NextBoxOut.mouseleave(function(){NextImg.stop(true, false).animate({opacity:0},tfade);});
    241273                } else {
    242274                        NextBoxOut.css("display","none");
Note: See TracChangeset for help on using the changeset viewer.