fabien-d / alertify.js

JavaScript Alert/Notification System
http://fabien-d.github.com/alertify.js/
4.26k stars 725 forks source link

ReferenceError: alertify is not defined using backbone and requireJS #183

Closed mstafkmx closed 11 years ago

fabien-d commented 11 years ago

Can you provide more info? A demo page, code samples...

mstafkmx commented 11 years ago

I am using backbone and RequireJS. colectores.js: define([], function () { jQuery.support.cors = true; $(document).ready(function () { console.log("colectores.js loaded"); alertify.success("Hi"); }); }); I have tried to use alerify en others files, but it not works.I load alertify using requireJS

fabien-d commented 11 years ago

the library detects if define is used and doesn't expose alertify globally. If you want to use with AMD, you need to include it as a dependency:

define( [ PATH_TO_ALERTIFY ], function ( alertify ) {
    alertify.success( 'Hi' );
} );
mstafkmx commented 11 years ago

Thanks Fabian. Tengo otro error. la notificación sale en el fondo de la página pero no desparece. I'm using css for bootstrap. alertify1

fabien-d commented 11 years ago

did you also include the alertify.core.css? you need both the core and theme styles.

mstafkmx commented 11 years ago

Thanks for your time. It works.

fabien-d commented 11 years ago

Great