Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrapper for jQuery. #33

Merged
merged 2 commits into from Apr 16, 2014
Merged

Add wrapper for jQuery. #33

merged 2 commits into from Apr 16, 2014

Conversation

seriema
Copy link
Contributor

@seriema seriema commented Dec 17, 2013

I love Ladda and that it's not dependent on anything. But it seems popular to wrap Ladda in a jQuery wrapper for those that want to use it. So I made a thin wrapper that can be loaded optionally by including ladda.jquery.min.js alongside ladda.min.js.

If this is accepted I'm willing to take the same approach to make an AngularJS version.

@luisrudge
Copy link

👍 for the angularjs version :)

@sbwMikael
Copy link

I'm... confused. Last night there were instructions for JQuery, tonight there are not. Yet Github says the Readme file has not been modified since last July. Also, in the Dist folder (last night) there was a file called ladda.jquery.js - which I downloaded and am in the process of using - and tonight it's not there. Again, Github records no changes in the past 24 hours, so I don't know what's going on.

It's as though I imagined the whole thing - except I have the files (and working JQuery with Ladda) to prove it. I know it's late, but I still can't figure out what's happened.

EDIT: uhm, OK, I see these additions in the two commits noted in this thread, but they're not appearing in the main release as they were yesterday.

@seriema
Copy link
Contributor Author

seriema commented Jan 15, 2014

@sbwMikael It sounds like you accidentally went into my fork/branch somehow. Glad that the code worked though! 🎱

@sbwMikael
Copy link

Ah! Yes, that would explain it. I'm pretty new to Github, and stumbling around a bit, so I probably clicked somewhere I hadn't intended. Yeah, it's great, thank you. The only issue I had with ladda.jquery.js was in the "else" clause towards the bottom of the file, where it begins with a comment:

"Binds the target buttons to automatically enter the..."

I kept getting warnings from Firebug that "options" wasn't defined (even after I'd created an options object and set values for timeout and callback). I'm new to JS and JQuery too, so still figuring things out. But it seems that which I click my ladda enabled button, the code below there doesn't know about the options object I passed in when I set the bind for ladda on my button (after document.ready).

So I added a test - if (typeof options != 'undefined')... and skip the options checking part if it isn't.

Also, I've no idea how/if I can dynamically set up a ladda bind on a button created after document.ready at the moment, but I think I might have a need for that. Not sure yet - I've got similar problems with X-Editable, but that's another story :)

Being new to JS/JQuery/HTML/CSS/Ladda, it threw me a little at first when I tried to change my ladda-enabled button text after the button had been clicked (in the success: callback for an AJAX call), which made the little spinner disappear from the button. Eventually I worked out that I needed to change the SPAN text below the button instead - oops.

@seriema
Copy link
Contributor Author

seriema commented Jan 15, 2014

Hmmm now I'm confused. There's no such comment in ladda.jquery.js, and there's no options object anywhere. Maybe you accidentally downloaded someone else's jquery version? At the top of this page, just by my original posting, click the tab Files changed. Scroll to find ladda.jquery.js and see if it's the same as you have.

@sbwMikael
Copy link

Hmm, I see what you mean! Uhh. OK, I need to post my copy somewhere so you can take a look at it because - well - I'm not sure what's going on :)

http://pastebin.com/raw.php?i=as5VAXyf

@seriema
Copy link
Contributor Author

seriema commented Jan 15, 2014

Ok yeah that's not this one. That's a reimplementation of Ladda in jQuery by someone else. The URL is at the top of that file. :)

@sbwMikael
Copy link

Ah-huh! Thank you for clearing that up. OK, I'd much rather use your official version so I'll look into swapping over soon. Best regards :)

@seriema
Copy link
Contributor Author

seriema commented Jan 15, 2014

Mine's not official, yet! This thread is part of my Pull Request, basically meaning I've created something I want the author to include in the official package. :) Click Ladda at the top to get to the official one.

@sbwMikael
Copy link

Oh I see :) Apologies. Well, it looks very promising so I hope Hakim will be encouraged to make a decision about adding it as part of the package!

@hakimel hakimel merged commit cdf3e22 into hakimel:master Apr 16, 2014
@hakimel
Copy link
Owner

hakimel commented Apr 16, 2014

Sorry about the lengthy delay on this – it's been merged in now and is available in the 0.9.3 release: https://github.com/hakimel/Ladda/releases/tag/0.9.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants