[Proto-Scripty] Strange ajax behaviour with effect.morph

2011-01-27 Thread Rey9999
Hi guys,

I'm setting up a simple website acting as a furniture catalogue.
I have a div which should display details about an item chosen by the
user from another menu.
the effect i need to obtain is this:
1 - div is morphed to have height=0;
2 - div content is set via ajax;
3 - div is morphed back to have its normal height.

I used javascript timers to make sure that the first morph and the
ajax call are complete before morphing it back. this is the code:


 new Effect.Morph( myDiv, { style:height:0px; } );
 load_page(page, myDiv); //this method implements the ajax call
 var t=setTimeout('new Effect.Morph( myDiv, { style:height:
222px;overflow:hidden; } ); ',2000);

What happens is that if I do not wait 5-6 seconds before choosing
another item, the ajax call takes place EVEN before the first morph!
so when an user clicks the item, the div changes its content and then
gets 'squeezed' and back to normal.
How do I ensure that these three events take place in the correct
order (that is squeeze the div, change the content and then grow back
to its regular size)?

thanks in advance.
Best Regards,
Rey

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Prototype.js Conflict

2011-01-27 Thread Umar Kaleem
Hello

I have installed Simple Controls Gallery v1.3 from dynamic drive
website and there is a conflict between Simple Controls Gallery v1.3
and prototype.js.

So basically, my Simple Control Gallery v1.3 is not working becuase of
the prototype conflict.

Any solution to fix this problem?

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: Prototype.js Conflict

2011-01-27 Thread T.J. Crowder
Hi,

Looks like the Simple Controls Gallery is using jQuery. The conflict
is between jQuery (which wants to use the `$` symbol) and Prototype
(which also wants to use `$`). The good news is that jQuery has a
`noConflict` mode, details here: http://api.jquery.com/jQuery.noConflict/

A glance at the Simple Controls Gallery code suggests that it's
noConflict-compatible and it doesn't have any `for..in` loops, so if
you add `noConflict` after loading jQuery and before loading
Prototype, you should be okay. E.g.:

script src=jquery.js/script
scriptjQuery.noConflict();/script
script src=prototype.js/script

HTH,
--
T.J. Crowder
Independent Software Engineer
tj / crowder software / com
www / crowder software / com

On Jan 26, 6:09 pm, Umar Kaleem technischcomp...@gmail.com wrote:
 Hello

 I have installed Simple Controls Gallery v1.3 from dynamic drive
 website and there is a conflict between Simple Controls Gallery v1.3
 and prototype.js.

 So basically, my Simple Control Gallery v1.3 is not working becuase of
 the prototype conflict.

 Any solution to fix this problem?

 Thanks

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Draggable always visible in overflow:hidden parent div

2011-01-27 Thread Adam Klekotka
Hello,
I'm new to scriptaculous. I'm creating little site with draggable
object (without droppable). The position of object is saved to the
database using ajax request. Additionally I want to forbid moving
object outside the parent div which has setted an overflow:hidden
attribute. Draggable object should be always visible in the parent
div.
I thought this is a popular thing but unfortunately I didn't find any
answer in google.

I read that in jquery draggable object can have containment attribute,
so is there any equivalent in scriptaculous? Or maybe I have to write
onChange function?

Thanks,
Adam

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: Draggable always visible in overflow:hidden parent div

2011-01-27 Thread Luke
Hi there,

you can do this with the snap-paramter. It 'normally' takes a value, but you 
can also pass it a function that sets the boundaries for your draggable 
element:

new Draggable('element', {
   snap: function(x, y) {
return[ (x  200) ? (x  0 ? x : 0 ) : 200,
(y  100) ? (y  0 ? y : 0) : 100 ];
}
});


The values 200 should be the width of your container MINUS the draggable's 
width and instead of 100 you should insert the container's height minus the 
height of the element.

Lukas

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: Strange ajax behaviour with effect.morph

2011-01-27 Thread Luke
Hi Rey,

you shouldn't use timers for this - you canot be sure when an ajaxrequest 
has finished loading. There are parameters both in the ajax-methods and in 
morph that take functions that will be called on a specific event like when 
the ajax-call has been loaded (these are called callbacks).

Check http://www.prototypejs.org/api/ajax/options section Common callbacks 
and http://madrobby.github.com/scriptaculous/core-effects/ for the part 
callbacks.

A simple usage would be

new Effect.Morph( myDiv, { style:height:0px;,
  afterFinish: function({
new Ajax.Request(url, {
  onSuccess: function(transport) {
new Effect.Morph( myDiv, { style:height: 222px;overflow:hidden; 
} );
  }
});
  })}
);

There might be syntax-errors in this

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] Re: Strange ajax behaviour with effect.morph

2011-01-27 Thread Richard Quadling
On 27 January 2011 13:47, Luke kickingje...@gmail.com wrote:
 Hi Rey,
 you shouldn't use timers for this - you canot be sure when an ajaxrequest
 has finished loading. There are parameters both in the ajax-methods and in
 morph that take functions that will be called on a specific event like when
 the ajax-call has been loaded (these are called callbacks).
 Check http://www.prototypejs.org/api/ajax/options section Common callbacks
 and http://madrobby.github.com/scriptaculous/core-effects/ for the part
 callbacks.
 A simple usage would be
 new Effect.Morph( myDiv, { style:height:0px;,
   afterFinish: function({
     new Ajax.Request(url, {
       onSuccess: function(transport) {
         new Effect.Morph( myDiv, { style:height: 222px;overflow:hidden;
 } );
       }
     });
   })}
 );

 There might be syntax-errors in this

If you ALWAYS want the morph to occur, even after a failure with the
AJAX call, the I would recommend using onComplete.

Read about the Common Callbacks on http://api.prototypejs.org/ajax/

onComplete: Triggered at the very end of a request's life-cycle, after
the request completes, status-specific callbacks are called, and
possible automatic behaviors are processed. Guaranteed to run
regardless of what happened during the request.



-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



Re: [Proto-Scripty] trapping form submit

2011-01-27 Thread Bertilo Wennergren
On Wed, Jan 26, 2011 at 15:55, code_bloke alastair.yo...@gmail.com wrote:

 Maybe I missing something here but I'm getting unexpected results
 observing the submit of a form.

 Given form and script below I would have expected that the form would
 not submit and the alert to be displayed, regardless of the means of
 causing the submit.

 What I find is that:
  1: pressing return in the text box causes the alert, but does not
 stop the submit
  2: the button does exactly the same
  3: the input type=button is not detected. No alert. Form submits
  4: the Plain old submit button alerts AND stops the submission.

 Where am I going wrong??

I think you need to return false in order to stop the normal submit.
It's not enough to do Event.stop(myEvent). The function needs to
return false also.

-- 
Bertil Wennergren

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] Re: Save toggle state on page refresh

2011-01-27 Thread js-vic
Thanks Ngoc! I'll give that a try.



On Jan 25, 1:40 am, Ngoc Anh Doan n...@nhdoan.de wrote:
 Hi,

 you see 
 herehttp://www.lalit.org/wordpress/wp-content/uploads/2008/06/cookiejar.jsthe 
 implementation of JS cookies with prototypejs.

 Cheers,

 Ngoc
 --

 Ngoc Anh Doan

 www:http://www.nhdoan.de
 Blog:http://blog.nhdoan.de
 Magento:http://demo.mage.nhdoan.de

 Am 25.01.2011 um 09:20 schrieb js-vic:







  Thanks in advance to anyone that can help,

  Based on the toggle effect (http://madrobby.github.com/scriptaculous/
  effect-toggle/), is there a simple way to store the state of the
  toggle when a page is refreshed/reloaded. I have come across a few
  mentions of setting a cookie but am not sure how to implement
  something like that.

  Any help would be much appreciated!

  --
  You received this message because you are subscribed to the Google Groups 
  Prototype  script.aculo.us group.
  To post to this group, send email to 
  prototype-scriptaculous@googlegroups.com.
  To unsubscribe from this group, send email to 
  prototype-scriptaculous+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Prototype  script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.



[Proto-Scripty] PeriodicalExecuter#stop

2011-01-27 Thread Walter Lee Davis
The documentation for PE shows this sort of construct used to stop the  
executer from inside itself:


new PeriodicalExecuter(function(pe){
if (foo == bar) {
pe.stop();
}else{
doSomething();
}
},5);

Now my other big use-case for this is that I need it to run until I  
ask it to stop from the outside, and if I do this, that seems also to  
work:


var pe; //global, or at least in the current outside scope
pe = new PeriodicalUpdater(function(){
doSomething();
},5);

$('bar').observe('click',function(evt){ pe.stop(); });

So do these two uses represent two different ways to use the stop  
method? Or am I looking at the 1.7 documentation and still using 1.6  
(which I am)?


Thanks for any clarification,

Walter

--
You received this message because you are subscribed to the Google Groups Prototype 
 script.aculo.us group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.