Author Topic: Loving JQuery  (Read 2816 times)

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Loving JQuery
« on: July 10, 2011, 09:21:09 PM »
So I've been using JQuery for little things like date picker widgets and stuff.  And then I needed to do some AJAX stuff and I decided to look at how JQuery handles AJAX calls.  Pretty decent.  For some reason I never took the time to grasp the syntax of JQuery (like how they reference fields and stuff).  I'm quite surprised at the ease of using JQuery.  This may become my JS tool of choice moving forward.

micah

  • A real person, on the Internet.
  • Ass Wipe
  • Posts: 6915
  • Karma: +58/-55
  • Truth cannot contradict truth.
    • micahj.com
Re: Loving JQuery
« Reply #1 on: July 11, 2011, 07:36:35 AM »
So I've been using JQuery for little things like date picker widgets and stuff.  And then I needed to do some AJAX stuff and I decided to look at how JQuery handles AJAX calls.  Pretty decent.  For some reason I never took the time to grasp the syntax of JQuery (like how they reference fields and stuff).  I'm quite surprised at the ease of using JQuery.  This may become my JS tool of choice moving forward.

i resisted at first as a purest, then I realized that it makes programming user interfaces a thousand times easier.  really really complex things can be handled in a couple lines of code.  I've been using it day-in and day-out for well over a year now.  :thumbsup:

and the plugins and sripts are so diverse and amazing.  I recently grabbed a validation script.  All you need to do is assign a class to the required form field and the script does the rest, adding inline error messages in real time.  crazy cool and easy.
"I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.  I use it to look at pictures of cats and get in arguments with strangers."

Mike

  • Jackass In Charge
  • Posts: 11257
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Re: Loving JQuery
« Reply #2 on: July 11, 2011, 08:00:28 AM »
Yeah, jQuery is a god-send.

hans

  • Guitar Addict
  • Jackass In Charge
  • Posts: 3523
  • Karma: +46/-18
Re: Loving JQuery
« Reply #3 on: July 11, 2011, 10:22:49 AM »
I've made the switch since working at my new job. I think prototype has lost favor (but I like either one just fine).
This signature intentionally left blank.

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: Loving JQuery
« Reply #4 on: July 11, 2011, 11:29:53 AM »
Micah, I completely understand the 'purest' attitude.  I thought I couldn't get the control I wanted out of jQuery but I was totally wrong!

Mike

  • Jackass In Charge
  • Posts: 11257
  • Karma: +168/-32
  • Ex Asshole - a better and more caring person.
Re: Loving JQuery
« Reply #5 on: July 11, 2011, 12:24:06 PM »
I've made the switch since working at my new job. I think prototype has lost favor (but I like either one just fine).
For me, the reason I went with jQuery over the other libraries is the amount of active 3rd party add-ons.  Most of the time where I've gone "I want to do XYZ" and it isn't in jQuery proper there is an extension for it.  Now I will admit to writing a few wrappers for those extensions to make using them easier.

micah

  • A real person, on the Internet.
  • Ass Wipe
  • Posts: 6915
  • Karma: +58/-55
  • Truth cannot contradict truth.
    • micahj.com
Re: Loving JQuery
« Reply #6 on: December 16, 2011, 10:08:05 AM »
another reason I love jQuery:

I'm making a page that lets you slide through a couple dozen images which include some text of a helpful factoid. (yes I know text doesn't belong in images but this is highly stylized info and each slide is very different in layout and format.)  Anyway, at any point you're supposed to be able to click "share on facebook" and the text from the current slide should be pre-filled as the caption that you post on your wall/timeline.

aside from using a super awesome and simple jQuery slider plugin (which works great on mobile platforms by responsively resizing images based on the window port size and also allows finger swiping) jQuery also saved the day with a super easy solution to dynamically setting the caption in the facebook function:

Code: [Select]
<ul>
 <li id="slide_0"><img src="images/factoids/slide1.png" alt="text of this slide" /></li>
 <li id="slide_1"><img src="images/factoids/slide2.png" alt="text of the next slide" /></li>
 <li id="slide_2"><img src="images/factoids/slide1.png" alt="text of... you get the idea" /></li>
</ul>             
<script>
var slide_number; // is an numeric variable I set on callback from the slider plugin to tell me which slide the user is looking at.

var facebook_caption = $("#slide_"+slide_number+" img").attr("alt");
</script>

I'm also doing some pretty cool /#!/hashbang  stuff too; updating the URL based on the current slide so you can link to the single page and have the slideshow start with the slide called from the URL.
"I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.  I use it to look at pictures of cats and get in arguments with strangers."

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
Re: Loving JQuery
« Reply #7 on: January 18, 2012, 11:08:35 AM »
Goddamn I have a massive jQuery boner right now.  So fast, so easy.