Tag Archive for 'jQuery'

Two notes on YCodaSlider

I think that newcomers need simple notes to use YCodaSlider.

First, include the required libraries:

  • jquery-1.2.6.pack.js
  • jquery-easing-1.3.pack.js
  • ycodaslider-2.0.js

then fire it up with a short script like this one:


YCodaSlider.Base.css('style.css');

jQuery(window).bind("load", function() {
    jQuery("div.ycodaslider").ycodaslider({width : 540, sidebars : false});
    jQuery("div.ycodaslider").width(540);
});

jQuery tabs and cookies

I’ve found many examples of scripts that save the selected tab inside a cookie but none of them worked out of the box… so let me write here a note and a snippet about how I got it working (big thanks to Massimiliano).

The XHTML that the snippet refers to is available on http://docs.jquery.com/UI/Tabs#source (you have to use its CSS or one of the same kind, of course).

You also need to include

  • ui.base.js
  • ui.tabs.js
  • jquery.cookie.js

The snippet (quick, dirty and raw… but working) is:


$(document).ready(function(){
  var tab_cookie_id = parseInt($.cookie("the_tab_cookie")) || 0;
  $("#example > ul").tabs({
    selected: tab_cookie_id,
    show:     function(ui) {
      var murl   = ui.tab;
      var nurl   = murl.toString().split("#");
      var ourl   = nurl[1].split(”-”);
      var tab_id = –ourl[1];
      $.cookie(”the_tab_cookie”, tab_id);
    }
  });
});