Reputation: 20727
I've started a php project, it will use cakePhp.
I saw that cakePhp has its Ajax Helper only working with prototype. Okay, not a problem, I can use prototype for the ajax helper.
The problem is that I wish to use javascript to ease my views development, using some cool features(e.g. slidedown the content of a div, ...).
I didn't find any way to do this with prototype(is it possible or not?), so I thought of using jquery only to do this, the problem is that they have both the same structure and when I try to do something like
$("mydiv").SlideDown("fast");
It never uses the correct library, so I think they are incompatible(because they have both the same synthax.
So what is my best shot with this kind of problem?
Upvotes: 0
Views: 612
Reputation: 37700
Your Prototype method was close, if you had just checked the documentation you would see what to do:
Effect.SlideDown('mydiv');
// or
Effect.SlideDown('mydiv', { duration: 0.3 }); // do it fast
I don't enjoy mixing frameworks; it confuses things, adds more bulk to each page and I believe means there is more to learn, not less. jQuery and Prototype have similar enough capabilities to rely on just one.
Upvotes: 0
Reputation: 7585
you need to be looking at the JsHelper and not the JavascriptHelpr.
Also, make sure you are using 1.3 as this was new to 1.3.
Upvotes: 0
Reputation: 21449
use jQuery("myDiv")
selector instead, or you can use jQuery.noConflict()
to return control over $
variable to prototype
Upvotes: 2
Reputation: 5481
Cake does support jquery (ver 1.3, but maybe not the ajax helper; I know the Js helper does). But personally, I just write straight js instead of relying on Cake. Cake's support for js is mostly limited to some data operations (ajax pagination, ajax login, etc.). For the rest (like slide down effect), you just have to write your own js.
Upvotes: 0