Reputation: 1
I am using this sample code found here, http://jaaulde.com/test_bed/stickytab/, and inserting in to a custom. js file to be used by my Drupal 7 install. I have the Omega theme running, and I'm successfully calling the script through my .info file.
The cookie works as intended, but obviously something is wrong because
This the code I'm using:
(function ($) {
Drupal.behaviors.omega_musicians = {
attach: function(context,settings) {
var cookieName, $tabs, stickyTab;
cookieName = 'stickyTab';
$tabs = $('#tabstoo');
$tabs.tabs({select: function( e, ui ) {
$.cookies.set(cookieName, ui.index);
}});
stickyTab = $.cookies.get(cookieName);
if(!isNaN(stickyTab)) {
$tabs.tabs('select', stickyTab);
}
} //eof attach
};
})(jQuery);
Upvotes: 0
Views: 3599
Reputation: 11
Besides the fact (to consider) that there is an issue with apache's mod_secure and cookies,
the ($) means the document and thus cookies is cookie (singular).
You can check the DOM from firebug to figure out the syntax. A lot of (attached behaviors) function (eg Drupal.toolbar.toggle) is using it.
I'm on the same pursuit and that's a short of clue for me about Drupal's js cookies.
Hope that helps.
Upvotes: 1