tags:

views:

104

answers:

1

Is it possible, using jQuery Tabs (Sortable) to pre-sort them by the current day?

<script type="text/javascript">
    $(function() {
        $("#tabs").tabs().find(".ui-tabs-nav").sortable({axis:'x'});
    });
</script>

I have 7 tabs, and the client wants the current day to display first.

Here is the site with tab examples: http://draft3.buildthesis.com/

A: 

I figured it out for myself. Rather than jack with any java, I build a conditional switch, and used the .CSS ui-tabs-selected instead. Now, whatever day of the week it is, that tab will display first. And whomever voted me down can kiss my ass.

function tabs() {

$day = date("D");
switch ($day) {
                case Mon:
                    $show1 = 'ui-tabs-selected';
                    break;
                case Tue:
                    $show2 = 'ui-tabs-selected';                
                    break;
                case Wed:
                    $show3 = 'ui-tabs-selected';
                    break;
                case Thu:
                    $show4 = 'ui-tabs-selected';
                    break;
                case Fri:
                    $show5 = 'ui-tabs-selected';
                    break;
                case Sat:
                    $show6 = 'ui-tabs-selected';
                    break;
                case Sun:
                    $show7 = 'ui-tabs-selected';
                    break;
   }
?>
<div id="tabs">
    <ul>
        <li class="<?php echo $show1; ?>"><a href="#tabs-1">Mon</a></li>
        <li class="<?php echo $show2; ?>"><a href="#tabs-2">Tue</a></li>
        <li class="<?php echo $show3; ?>"><a href="#tabs-3">Wed</a></li>
        <li class="<?php echo $show4; ?>"><a href="#tabs-4">Thur</a></li>
        <li class="<?php echo $show5; ?>"><a href="#tabs-5">Fri</a></li>
        <li class="<?php echo $show6; ?>"><a href="#tabs-6">Sat</a></li>
        <li class="<?php echo $show7; ?>"><a href="#tabs-7">Sun</a></li>
    </ul>
Greg