0

I want to use Zepto in a page that has both jQuery and Prototype. But i can't find noConflict() in Zepto documentation. I use my jquery code with prototype on the same page so no-conflict is very important.

Can someone let me know how to use Zepto in noConflict mode?

MayThrow
  • 2,159
  • 4
  • 24
  • 38
  • 2
    Hold on, why are you including jQuery *and* Zepto? – Jared Farrish Sep 29 '12 at 12:20
  • Zepto boasts that it is supposed to be a lighter and faster jQuery. Why are you trying to load a lightweight library on a page that already has two heavier libraries - one of which Zepto is based on? – cwd Sep 29 '12 at 12:20
  • why zepto? - Because Zepto has better animation performance. why jQuery? - Because jQuery is cross-browser compatible. Afaik Zepto doesn't support IE – MayThrow Sep 29 '12 at 12:22
  • 1
    It looks like [here in the source](https://github.com/madrobby/zepto/blob/master/src/zepto.js#L642) if you include Zepto after jQuery or whatever library that *will* get `$`, it will not set it (defacto `noConflict()`. – Jared Farrish Sep 29 '12 at 12:23
  • @Jared Thanks. Post this as an answer – MayThrow Sep 29 '12 at 12:27

1 Answers1

4

It looks like here in the source if you include Zepto after jQuery or whatever library that will get $, it will not set it (defacto noConflict()):

// If `$` is not yet defined, point it to `Zepto`
window.Zepto = Zepto
'$' in window || (window.$ = Zepto)
Jared Farrish
  • 48,585
  • 17
  • 95
  • 104