How do you get jQuery tabs working in Wordpress 2.8?

View: New views
14 Messages — Rating Filter:   Alert me  

How do you get jQuery tabs working in Wordpress 2.8?

by Mark Cunningham-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've been doing some testing of my plugin on Wordpress 2.8 beta 2. I
am using the Wordpress built-in jQuery and jQuery tabs to generate
tabbed interface to my plugins options. But on the upgrade to 2.8, the
tabs no longer work any more. I've checked documentation for jQuery
tabs, and I don't appear to be doing anything wrong. Has anyone else
got jQuery tabs working on Wordpress 2.8?

Thanks
Mark
--
http://thedeadone.net
http://lostheroesrpg.com
http://irishgamingwiki.com
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by chrisbliss18 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I haven't run into your specific problem, but I believe that I know the
cause. 2.8 has split the scripts into two groups: those that are added
in the header and those that are added in the footer. jquery-ui-tabs is
one of the many scripts that now loads in the footer. View the source,
scroll to the bottom, and you'll see what I am talking about.

If you have any js code that relies on scripts that are loaded in the
footer, you need to ensure that you wrap that code and tell it to not
run until the document has fully loaded. This is easily done by wrapping
the code in a jQuery(document).ready function. For example:

    jQuery(document).ready( function() {
        // Code that relies on scripts loaded in the footer.
    } );

One problem that I've already come across while doing this is that
wrapping functions in that segment of code causes those functions to not
be accessible to other js code that originates from outside that ready
function. The solution I've created to work around this is to use an
initializing function and use the ready function inside it. For example:

    function init_my_script() {
        jQuery(document).ready( function() {
            create_ui_tabs();
            update_my_links();
            // etc
        } );
    }

    function create_ui_tabs() {
        // Do stuff
    }

    function update_my_links() {
        // Do stuff
    }

    init_my_script();
     

This way you make your code run after all the scripts are loaded while
also allowing the key functions to be accessible from other code.

If you want to find out which scripts are loaded in the footer, check
out the wp-includes/script-loader.php file of the latest trunk. There is
a comment above the wp_default_scripts function that indicates which
ones are loaded in the footer. You'll find that most of the scripts are
now loaded in the footer. So, I recommend creating all future js code
(and updating old js code) to have init functions with contents wrapped
in the ready function. If you don't do this, you'll find a great amount
of your js causing fatal errors and crashing the js execution.

I hope that this helps you out Mark.

Chris Jean
http://gaarai.com/
http://wp-roadmap.com/



Mark Cunningham wrote:

> I've been doing some testing of my plugin on Wordpress 2.8 beta 2. I
> am using the Wordpress built-in jQuery and jQuery tabs to generate
> tabbed interface to my plugins options. But on the upgrade to 2.8, the
> tabs no longer work any more. I've checked documentation for jQuery
> tabs, and I don't appear to be doing anything wrong. Has anyone else
> got jQuery tabs working on Wordpress 2.8?
>
> Thanks
> Mark
>  
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Mark Cunningham-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Gaarai,

Thanks for taking the time to reply.

> If you have any js code that relies on scripts that are loaded in the
> footer, you need to ensure that you wrap that code and tell it to not run
> until the document has fully loaded. This is easily done by wrapping the
> code in a jQuery(document).ready function. For example:
>
>   jQuery(document).ready( function() {
>       // Code that relies on scripts loaded in the footer.
>   } );

I was unaware of the change to have the scripts loaded in the footer,
but luckily I was already implementing my initialisation this way.

> One problem that I've already come across while doing this is that wrapping
> functions in that segment of code causes those functions to not be
> accessible to other js code that originates from outside that ready
> function. The solution I've created to work around this is to use an
> initializing function and use the ready function inside it. For example:

I tried this and it has made no difference. I'm not sure if that's the
source of the problem.

Thanks
Mark

2009/5/28 Gaarai <gaarai@...>:

> I haven't run into your specific problem, but I believe that I know the
> cause. 2.8 has split the scripts into two groups: those that are added in
> the header and those that are added in the footer. jquery-ui-tabs is one of
> the many scripts that now loads in the footer. View the source, scroll to
> the bottom, and you'll see what I am talking about.
>
> If you have any js code that relies on scripts that are loaded in the
> footer, you need to ensure that you wrap that code and tell it to not run
> until the document has fully loaded. This is easily done by wrapping the
> code in a jQuery(document).ready function. For example:
>
>   jQuery(document).ready( function() {
>       // Code that relies on scripts loaded in the footer.
>   } );
>
> One problem that I've already come across while doing this is that wrapping
> functions in that segment of code causes those functions to not be
> accessible to other js code that originates from outside that ready
> function. The solution I've created to work around this is to use an
> initializing function and use the ready function inside it. For example:
>
>   function init_my_script() {
>       jQuery(document).ready( function() {
>           create_ui_tabs();
>           update_my_links();
>           // etc
>       } );
>   }
>
>   function create_ui_tabs() {
>       // Do stuff
>   }
>
>   function update_my_links() {
>       // Do stuff
>   }
>
>   init_my_script();
>
> This way you make your code run after all the scripts are loaded while also
> allowing the key functions to be accessible from other code.
>
> If you want to find out which scripts are loaded in the footer, check out
> the wp-includes/script-loader.php file of the latest trunk. There is a
> comment above the wp_default_scripts function that indicates which ones are
> loaded in the footer. You'll find that most of the scripts are now loaded in
> the footer. So, I recommend creating all future js code (and updating old js
> code) to have init functions with contents wrapped in the ready function. If
> you don't do this, you'll find a great amount of your js causing fatal
> errors and crashing the js execution.
>
> I hope that this helps you out Mark.
>
> Chris Jean
> http://gaarai.com/
> http://wp-roadmap.com/
>
>
>
> Mark Cunningham wrote:
>>
>> I've been doing some testing of my plugin on Wordpress 2.8 beta 2. I
>> am using the Wordpress built-in jQuery and jQuery tabs to generate
>> tabbed interface to my plugins options. But on the upgrade to 2.8, the
>> tabs no longer work any more. I've checked documentation for jQuery
>> tabs, and I don't appear to be doing anything wrong. Has anyone else
>> got jQuery tabs working on Wordpress 2.8?
>>
>> Thanks
>> Mark
>>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



--
http://thedeadone.net
http://lostheroesrpg.com
http://irishgamingwiki.com
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Alex Rabe-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I had a problem with this init :

jQuery('#slider > ul').tabs({ fxFade: true, fxSpeed: 'fast' });

with Jquery UI 1.7 , (which is part of WP 2.8, I need to change it in
this way :

jQuery('#slider').tabs({ fxFade: true, fxSpeed: 'fast' });

Alex


On 28 Mai, 15:24, Mark Cunningham <mark.cunning...@...> wrote:

> Hi Gaarai,
>
> Thanks for taking the time to reply.
>
> > If you have any js code that relies on scripts that are loaded in the
> > footer, you need to ensure that you wrap that code and tell it to not run
> > until the document has fully loaded. This is easily done by wrapping the
> > code in a jQuery(document).ready function. For example:
>
> >   jQuery(document).ready( function() {
> >       // Code that relies on scripts loaded in the footer.
> >   } );
>
> I was unaware of the change to have the scripts loaded in the footer,
> but luckily I was already implementing my initialisation this way.
>
> > One problem that I've already come across while doing this is that wrapping
> > functions in that segment of code causes those functions to not be
> > accessible to other js code that originates from outside that ready
> > function. The solution I've created to work around this is to use an
> > initializing function and use the ready function inside it. For example:
>
> I tried this and it has made no difference. I'm not sure if that's the
> source of the problem.
>
> Thanks
> Mark
>
> 2009/5/28 Gaarai <gaa...@...>:
>
>
>
>
>
> > I haven't run into your specific problem, but I believe that I know the
> > cause. 2.8 has split the scripts into two groups: those that are added in
> > the header and those that are added in the footer. jquery-ui-tabs is one of
> > the many scripts that now loads in the footer. View the source, scroll to
> > the bottom, and you'll see what I am talking about.
>
> > If you have any js code that relies on scripts that are loaded in the
> > footer, you need to ensure that you wrap that code and tell it to not run
> > until the document has fully loaded. This is easily done by wrapping the
> > code in a jQuery(document).ready function. For example:
>
> >   jQuery(document).ready( function() {
> >       // Code that relies on scripts loaded in the footer.
> >   } );
>
> > One problem that I've already come across while doing this is that wrapping
> > functions in that segment of code causes those functions to not be
> > accessible to other js code that originates from outside that ready
> > function. The solution I've created to work around this is to use an
> > initializing function and use the ready function inside it. For example:
>
> >   function init_my_script() {
> >       jQuery(document).ready( function() {
> >           create_ui_tabs();
> >           update_my_links();
> >           // etc
> >       } );
> >   }
>
> >   function create_ui_tabs() {
> >       // Do stuff
> >   }
>
> >   function update_my_links() {
> >       // Do stuff
> >   }
>
> >   init_my_script();
>
> > This way you make your code run after all the scripts are loaded while also
> > allowing the key functions to be accessible from other code.
>
> > If you want to find out which scripts are loaded in the footer, check out
> > the wp-includes/script-loader.php file of the latest trunk. There is a
> > comment above the wp_default_scripts function that indicates which ones are
> > loaded in the footer. You'll find that most of the scripts are now loaded in
> > the footer. So, I recommend creating all future js code (and updating old js
> > code) to have init functions with contents wrapped in the ready function. If
> > you don't do this, you'll find a great amount of your js causing fatal
> > errors and crashing the js execution.
>
> > I hope that this helps you out Mark.
>
> > Chris Jean
> >http://gaarai.com/
> >http://wp-roadmap.com/
>
> > Mark Cunningham wrote:
>
> >> I've been doing some testing of my plugin on Wordpress 2.8 beta 2. I
> >> am using the Wordpress built-in jQuery and jQuery tabs to generate
> >> tabbed interface to my plugins options. But on the upgrade to 2.8, the
> >> tabs no longer work any more. I've checked documentation for jQuery
> >> tabs, and I don't appear to be doing anything wrong. Has anyone else
> >> got jQuery tabs working on Wordpress 2.8?
>
> >> Thanks
> >> Mark
>
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hack...@...
> >http://lists.automattic.com/mailman/listinfo/wp-hackers
>
> --http://thedeadone.nethttp://lostheroesrpg.comhttp://irishgamingwiki.com
> _______________________________________________
> wp-hackers mailing list
> wp-hack...@...://lists.automattic.com/mailman/listinfo/wp-hackers- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: Re: How do you get jQuery tabs working in Wordpress 2.8?

by Mark Cunningham-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Alex,

> with Jquery UI 1.7 , (which is part of WP 2.8, I need to change it in
> this way :
>
> jQuery('#slider').tabs({ fxFade: true, fxSpeed: 'fast' });

Ah! That was it. Thanks everyone for you're help.

Mark

2009/5/28 Alex Rabe <alex.cologne@...>:

> I had a problem with this init :
>
> jQuery('#slider > ul').tabs({ fxFade: true, fxSpeed: 'fast' });
>
> with Jquery UI 1.7 , (which is part of WP 2.8, I need to change it in
> this way :
>
> jQuery('#slider').tabs({ fxFade: true, fxSpeed: 'fast' });
>
> Alex
>
>
> On 28 Mai, 15:24, Mark Cunningham <mark.cunning...@...> wrote:
>> Hi Gaarai,
>>
>> Thanks for taking the time to reply.
>>
>> > If you have any js code that relies on scripts that are loaded in the
>> > footer, you need to ensure that you wrap that code and tell it to not run
>> > until the document has fully loaded. This is easily done by wrapping the
>> > code in a jQuery(document).ready function. For example:
>>
>> >   jQuery(document).ready( function() {
>> >       // Code that relies on scripts loaded in the footer.
>> >   } );
>>
>> I was unaware of the change to have the scripts loaded in the footer,
>> but luckily I was already implementing my initialisation this way.
>>
>> > One problem that I've already come across while doing this is that wrapping
>> > functions in that segment of code causes those functions to not be
>> > accessible to other js code that originates from outside that ready
>> > function. The solution I've created to work around this is to use an
>> > initializing function and use the ready function inside it. For example:
>>
>> I tried this and it has made no difference. I'm not sure if that's the
>> source of the problem.
>>
>> Thanks
>> Mark
>>
>> 2009/5/28 Gaarai <gaa...@...>:
>>
>>
>>
>>
>>
>> > I haven't run into your specific problem, but I believe that I know the
>> > cause. 2.8 has split the scripts into two groups: those that are added in
>> > the header and those that are added in the footer. jquery-ui-tabs is one of
>> > the many scripts that now loads in the footer. View the source, scroll to
>> > the bottom, and you'll see what I am talking about.
>>
>> > If you have any js code that relies on scripts that are loaded in the
>> > footer, you need to ensure that you wrap that code and tell it to not run
>> > until the document has fully loaded. This is easily done by wrapping the
>> > code in a jQuery(document).ready function. For example:
>>
>> >   jQuery(document).ready( function() {
>> >       // Code that relies on scripts loaded in the footer.
>> >   } );
>>
>> > One problem that I've already come across while doing this is that wrapping
>> > functions in that segment of code causes those functions to not be
>> > accessible to other js code that originates from outside that ready
>> > function. The solution I've created to work around this is to use an
>> > initializing function and use the ready function inside it. For example:
>>
>> >   function init_my_script() {
>> >       jQuery(document).ready( function() {
>> >           create_ui_tabs();
>> >           update_my_links();
>> >           // etc
>> >       } );
>> >   }
>>
>> >   function create_ui_tabs() {
>> >       // Do stuff
>> >   }
>>
>> >   function update_my_links() {
>> >       // Do stuff
>> >   }
>>
>> >   init_my_script();
>>
>> > This way you make your code run after all the scripts are loaded while also
>> > allowing the key functions to be accessible from other code.
>>
>> > If you want to find out which scripts are loaded in the footer, check out
>> > the wp-includes/script-loader.php file of the latest trunk. There is a
>> > comment above the wp_default_scripts function that indicates which ones are
>> > loaded in the footer. You'll find that most of the scripts are now loaded in
>> > the footer. So, I recommend creating all future js code (and updating old js
>> > code) to have init functions with contents wrapped in the ready function. If
>> > you don't do this, you'll find a great amount of your js causing fatal
>> > errors and crashing the js execution.
>>
>> > I hope that this helps you out Mark.
>>
>> > Chris Jean
>> >http://gaarai.com/
>> >http://wp-roadmap.com/
>>
>> > Mark Cunningham wrote:
>>
>> >> I've been doing some testing of my plugin on Wordpress 2.8 beta 2. I
>> >> am using the Wordpress built-in jQuery and jQuery tabs to generate
>> >> tabbed interface to my plugins options. But on the upgrade to 2.8, the
>> >> tabs no longer work any more. I've checked documentation for jQuery
>> >> tabs, and I don't appear to be doing anything wrong. Has anyone else
>> >> got jQuery tabs working on Wordpress 2.8?
>>
>> >> Thanks
>> >> Mark
>>
>> > _______________________________________________
>> > wp-hackers mailing list
>> > wp-hack...@...
>> >http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>> --http://thedeadone.nethttp://lostheroesrpg.comhttp://irishgamingwiki.com
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hack...@...://lists.automattic.com/mailman/listinfo/wp-hackers- Zitierten Text ausblenden -
>>
>> - Zitierten Text anzeigen -
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



--
http://thedeadone.net
http://lostheroesrpg.com
http://irishgamingwiki.com
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Daiv Mowbray :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,
I have the same problem,
works fine in 2.7 but 2.8 tabs are failing.
The previously made suggestions haven't worked for me.

I am using the following :

function init_my_script() {
                jQuery(document).ready( function() {
                        create_ui_tabs();
                } );
}
function create_ui_tabs() {
                jQuery('#mytabsnav').tabs({ fxFade: true, fxSpeed: 'fast' });
}

init_my_script();

The above script actually loads into mid body.

The jquery-ui-tabs script is loading into the footer;
<script type='text/javascript' src='http://localhost/wordpress_2.8/wp-admin/load-scripts.php?c=1&load=hoverIntent,common,jquery-color,jquery-ui-core,jquery-ui-tabs&ver=cf44a8aa087bf74bbcc19532e4707902' 
 ></script>


Thank for any pointers.


On May 28, 2009, at 12:55 PM, Mark Cunningham wrote:

> I've been doing some testing of my plugin on Wordpress 2.8 beta 2. I
> am using the Wordpress built-in jQuery and jQuery tabs to generate
> tabbed interface to my plugins options. But on the upgrade to 2.8, the
> tabs no longer work any more. I've checked documentation for jQuery
> tabs, and I don't appear to be doing anything wrong. Has anyone else
> got jQuery tabs working on Wordpress 2.8?


----------
Daiv Mowbray
daiv@...
-----------------------------




_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Ozh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>
> init_my_script();
>

jQuery(document).ready(function(){
        init_my_script();
});
might change if the error is because you're firing the init before
jquery-tabs have loaded (they're in the footer now, remember)

Ozh

_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Dylan Kuhn-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I found by experimenting that in jQuery 1.3.x I have to select the container
of the tab UL, whereas in 1.2.x I had been selecting the UL itself. My
attempt (not claiming best practice) at code to work in both is something
like:

    jQuery(function() {
        var selector = '#tabs-container';
        if ( typeof jQuery.prototype.selector === 'undefined' ) {
            // We have jQuery 1.2.x, tabs work better on UL
            selector += ' > ul';
        }
        jQuery( selector ).tabs();

-dylan-

On Thu, Jun 18, 2009 at 5:19 AM, Ozh <ozh@...> wrote:

> >
> > init_my_script();
> >
>
> jQuery(document).ready(function(){
>         init_my_script();
> });
> might change if the error is because you're firing the init before
> jquery-tabs have loaded (they're in the footer now, remember)
>
> Ozh
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Dylan Kuhn-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I found by experimenting that in jQuery 1.3.x I have to select the container
of the tab UL, whereas in 1.2.x I had been selecting the UL itself. My
attempt (not claiming best practice) at code to work in both is something
like:

    jQuery(function() {
        var selector = '#tabs-container';
        if ( typeof jQuery.prototype.selector === 'undefined' ) {
            // We have jQuery 1.2.x, tabs work better on UL
            selector += ' > ul';
        }
        jQuery( selector ).tabs();
    }

-dylan-

On Thu, Jun 18, 2009 at 5:19 AM, Ozh <ozh@...> wrote:

> >
> > init_my_script();
> >
>
> jQuery(document).ready(function(){
>         init_my_script();
> });
> might change if the error is because you're firing the init before
> jquery-tabs have loaded (they're in the footer now, remember)
>
> Ozh
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Andrew Ozz :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dylan Kuhn wrote:
> I found by experimenting that in jQuery 1.3.x I have to select the container
> of the tab UL, whereas in 1.2.x I had been selecting the UL itself.

Yes, jQuery UI Tabs has some changes in UI 1.7.1 and is not used in 2.8
any more. If you only need basic tab switching it takes only couple of
lines of js to do directly in jQuery and would be compatible with both
1.2 and 1.3.
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Heiko Rabe :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It's very easy to write code that works for WP 2.7 and Wp 2.8 accourding
to jQuery Tabs.
I wrote an article (sorry german only) but the essentials are this:

//jQuery UI 1.5.2 doesn’t expect tab ID’s at DIV, so we have to apply a
hotfix instead
var *needs_jquery_hotfix* = (($.ui.version === undefined) ||
(parseInt($.ui.version.split(’.')[1]) < 7));
$("#tabs"+(*needs_jquery_hotfix* ? “>ul” : “”)).tabs({
//do you init stuff here
});

To test the UI instead of jQuery is the better way, because the tabs
component inherits from rewritten jQuery widget class.
Also some more patches can be easly applied against a older UI version
to work as it would be a 1.7+ version.

regards


Andrew Ozz schrieb:

> Dylan Kuhn wrote:
>> I found by experimenting that in jQuery 1.3.x I have to select the
>> container
>> of the tab UL, whereas in 1.2.x I had been selecting the UL itself.
>
> Yes, jQuery UI Tabs has some changes in UI 1.7.1 and is not used in
> 2.8 any more. If you only need basic tab switching it takes only
> couple of lines of js to do directly in jQuery and would be compatible
> with both 1.2 and 1.3.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>

_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Daiv Mowbray :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi thanx for the feedback, and well, I'm perplexed.
I've applied the jquery as such;

function create_ui_tabs() {

    jQuery(function() {
         var selector = '#ssslider';
             if ( typeof jQuery.prototype.selector === 'undefined' ) {
            // We have jQuery 1.2.x, tabs work better on UL
              selector += ' > ul';
          }
         jQuery( selector ).tabs({ fxFade: true, fxSpeed: 'slow' });

     });
};

jQuery(document).ready(function(){
         create_ui_tabs();
});
____________________________________

and my html is:

<div id="ssslider" class="ui-tabs">
     <ul id="ssnav" class="ui-tabs-nav">
         <li class="ui-tabs-selected"><a  
href="#fragment-1"><span>Global Options</span></a></li>
         <li class="ui-state-default"><a  
href="#fragment-2"><span>Plugins Appearance</span></a></li>
         <li class="ui-state-default" style="display: none;"><a  
href="#fragment-9"><span>Comment Slider</span></a></li>
     </ul>
     <div id="fragment-1" class="ui-tabs-panel">
...




On Jun 18, 2009, at 3:29 PM, Dylan Kuhn wrote:

> I found by experimenting that in jQuery 1.3.x I have to select the  
> container
> of the tab UL, whereas in 1.2.x I had been selecting the UL itself. My
> attempt (not claiming best practice) at code to work in both is  
> something
> like:


----------
Daiv Mowbray
daiv@...
----------


_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Daiv Mowbray :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Correction to my last post:

It seems that I failed to update cache or something.
This following does work for 2.7 and 2.8 :
______________________

  <script type="text/javascript">
// <![CDATA[

function create_ui_tabs() {
     jQuery(function() {
         var selector = '#ssslider';
             if ( typeof jQuery.prototype.selector === 'undefined' ) {
             // We have jQuery 1.2.x, tabs work better on UL
             selector += ' > ul';
         }
         jQuery( selector ).tabs({ fxFade: true, fxSpeed: 'slow' });

     });
}

jQuery(document).ready(function(){
         create_ui_tabs();
});

// ]]>
</script>
__________________________



On Jun 19, 2009, at 10:44 AM, Daiv Mowbray wrote:

> Hi thanx for the feedback, and well, I'm perplexed.
> I've applied the jquery as such;


----------
Daiv Mowbray
daiv@...
----------


_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers

Re: How do you get jQuery tabs working in Wordpress 2.8?

by Dylan Kuhn-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Good. Just for clarity, I think the only necessary code is the content of
you create_ui_tabs function. jQuery( function() { } ) is a shortcut for
jQuery(document).ready( function() { } ) - maybe a good example of how
shortcuts can reduce readbility.

Secondly, I agree with Heiko that testing the UI version is probably more
robust, since tabs() is UI code. I also agree with Ozh that not using tabs
at all is much more robust :). I'll probably use a compromise myself for
now.

-dylan-

On Fri, Jun 19, 2009 at 3:49 AM, Daiv Mowbray <daiv@...> wrote:

> Correction to my last post:
>
> It seems that I failed to update cache or something.
> This following does work for 2.7 and 2.8 :
> ______________________
>
>  <script type="text/javascript">
> // <![CDATA[
>
> function create_ui_tabs() {
>    jQuery(function() {
>        var selector = '#ssslider';
>            if ( typeof jQuery.prototype.selector === 'undefined' ) {
>            // We have jQuery 1.2.x, tabs work better on UL
>            selector += ' > ul';
>        }
>        jQuery( selector ).tabs({ fxFade: true, fxSpeed: 'slow' });
>
>    });
> }
>
> jQuery(document).ready(function(){
>        create_ui_tabs();
> });
>
> // ]]>
> </script>
> __________________________
>
>
>
> On Jun 19, 2009, at 10:44 AM, Daiv Mowbray wrote:
>
>  Hi thanx for the feedback, and well, I'm perplexed.
>> I've applied the jquery as such;
>>
>
>
> ----------
> Daiv Mowbray
> daiv@...
> ----------
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers@...
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
_______________________________________________
wp-hackers mailing list
wp-hackers@...
http://lists.automattic.com/mailman/listinfo/wp-hackers