Hi there Klaus,

Thanx for your answer, ive tried all day to get this to work, but im doing
something wrong.
This is the code im trying to get the cookies to work with, please see if
you could help me out.
Maybe it will help others out to, since it seems to be hard to figure out.
Or im having my thumb up my a** ;)

$(document).ready(
   function()

   {
       $('#windowOpen').bind(
           'click',
           function() {
               if($('#window').css('display') == 'none') {
                   $(this).TransferTo(
                       {
                           to:'window',
                           className:'transferer2',
                           duration: 400,
                           complete: function()
                           {
                               $('#window').show();
                           }
                       }
                   );
               }
               this.blur();
               return false;
           }
       );
       $('#windowClose').bind(
           'click',
           function()
           {
               $('#window').TransferTo(
                   {
                       to:'windowOpen',
                       className:'transferer2',
                       duration: 400
                   }
               ).hide();
           }
       );
       $('#windowMin').bind(
           'click',
           function()
           {
               $('#windowContent').BlindToggleVertically(300);
               $('#windowBottom, #windowBottomContent').animate({height:
10}, 300);
               $('#window').animate({height:40},300).get(0).isMinimized =
true;
               $(this).hide();
               $('#windowResize').hide();
               $('#windowMax').show();
           }
       );
       $('#windowMax').bind(
           'click',
           function()
           {
               var windowSize = $.iUtil.getSize(document.getElementById
('windowContent'));
               $('#windowContent').SlideToggleUp(300);
               $('#windowBottom, #windowBottomContent').animate({height:
windowSize.hb + 13}, 300);
               $('#window').animate({height:windowSize.hb+43},
300).get(0).isMinimized = false;
               $(this).hide();
               $('#windowMin, #windowResize').show();
           }
       );
       $('#window').Resizable(
           {
               minWidth: 400,
               minHeight: 10,
               maxWidth: 700,
               maxHeight: 445,
               dragHandle: '#windowTop',
               handlers: {
                   se: '#windowResize'
               },
               onResize : function(size, position) {
                   $('#windowBottom, #windowBottomContent').css('height',
size.height-33 + 'px');
                   var windowContentEl = $('#windowContent').css('width',
size.width - 25 + 'px');
                   if (!document.getElementById('window').isMinimized) {
                       windowContentEl.css('height', size.height - 48 +
'px');
                   }
               }
           }
       );
   }
);

Thanx alot. / Nisse.

On 2/18/07, Klaus Hartl <[EMAIL PROTECTED]> wrote:

Mikael Noone schrieb:
> Hi there,
>
> I used the interface plugin to make a window be draggable,
> now i found a good cookie plugin:
> http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/
> <http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/>
>
> How do i use them to make it remember the position?...
> Ive tried alot of examples of ordinary javascript + cookie
> but i cant get it to work with the plugin.
>
> I appriciate all help (sorry for bad english, im german)..
>
> Thanx. Nisse.

If you have the position stored in a variable as a string like for example

var pos = 'x=112,y=330';

you can easily save this in and read it from the cookie like this:

var POS_COOKIE = 'window_position';

// get latest position
var pos = $.cookie(POS_COOKIE);

// save position, cookie expires after one year
var pos = ...;
$.cookie(POS_COOKIE, pos, {expires: 365});

For computing the window position the dimensions plugin is probably
useful. Or maybe there's something build into Interface already.


-- Klaus


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to