Be Excellent To Each Other
https://www.beexcellenttoeachother.com/forum/

jQuery
https://www.beexcellenttoeachother.com/forum/viewtopic.php?f=3&t=5382
Page 1 of 3

Author:  Grim... [ Thu Jan 21, 2010 16:21 ]
Post subject:  jQuery

If you use jQuery (like I do) you might not know that jQuery 1.4 was released last week (like I didn't).

Info here: http://jquery14.com/day-01

Bottom line: It's far faster.

Author:  Malabelm [ Thu Jan 21, 2010 16:25 ]
Post subject:  Re: jQuery

I should probably stop using

Code:
$(function() {

});


now as a lazy way to initialise things, then. Pfft.

I haven't upgraded yet. It's nice to see there's a plugin to enable backwards compatibility, but I'd rather tweak my existing sites if anything does indeed break.

Author:  The Rev Owen [ Thu Jan 21, 2010 16:27 ]
Post subject:  Re: jQuery

Never used it, but I need to start really using more JavaScript in our Intranet, so I might take the plunge. Seems to do stuff that I want the fancy new version of our site to do.

Author:  Grim... [ Thu Jan 21, 2010 16:30 ]
Post subject:  Re: jQuery

It's a lovely little library. Are you comfortable using CSS selectors?

Author:  The Rev Owen [ Thu Jan 21, 2010 16:36 ]
Post subject:  Re: jQuery

Grim... wrote:
It's a lovely little library. Are you comfortable using CSS selectors?


I don't do anything very complicated with them at present.

Author:  Malabelm [ Thu Jan 21, 2010 16:37 ]
Post subject:  Re: jQuery

Malabar Front wrote:
I should probably stop using

Code:
$(function() {

});


now as a lazy way to initialise things, then. Pfft.

I haven't upgraded yet. It's nice to see there's a plugin to enable backwards compatibility, but I'd rather tweak my existing sites if anything does indeed break.


Oh, no. That still works, apparently.

Reading through the changes, and there are lots of brilliant things in there. Plenty of stuff I can already see real applications for and ways to simplify my existing code. Excellent.

Author:  Grim... [ Thu Jan 21, 2010 16:45 ]
Post subject:  Re: jQuery

The Rev Owen wrote:
Grim... wrote:
It's a lovely little library. Are you comfortable using CSS selectors?


I don't do anything very complicated with them at present.

jQuery identifies page elements in the same way as CSS does.

For instance,
Code:
$(".footer").html(); //gets you all the HTML in your footer(s)
$("img").hide(); //hides all your images
$("#option_1").css({"color":"red"}); //changes your text to red if it's in something with the id 'option_1'

You can do all the complicated selectors too, like
Code:
$("div > span").something();
$("div[class~='x']").something();
$("div[id|='brian'").something();

Author:  The Rev Owen [ Thu Jan 21, 2010 16:51 ]
Post subject:  Re: jQuery

That seems nice.

Author:  Grim... [ Thu Jan 21, 2010 16:57 ]
Post subject:  Re: jQuery

It is very nice.
The spoiler tags use jQuery, and it's only a tiny bit of code:
Code:
$(".jqspoiler").click(function() {
    $(this).children(".hidey").slideToggle(200);
});

In pseodo, that basically says:
Find all the elements (divs, in this case) with the class '.jqspoiler' and run this function when someone clicks on them
Any elements (divs again) that lay inside the one that was just clicked on with the class '.hidey' should be slid upward and hidden if they are visible, and downward and shown if not. Spend 200 milliseconds doing the sliding.

Apply some CSS to make the .hidey divs hidden by default and that's it!

Author:  The Rev Owen [ Thu Jan 21, 2010 16:59 ]
Post subject:  Re: jQuery

I like it!

Maybe soon our Intranet will be in the twenty-first century!

Author:  Grim... [ Fri Jul 09, 2010 10:06 ]
Post subject:  Re: jQuery

Hello!
I have a nice eBook about Jquery, and another about Javascript. They are in both PDF and .mobi formats.

Anyone wany a copy?

Author:  markg [ Fri Jul 09, 2010 10:08 ]
Post subject:  Re: jQuery

Yes please Grim... coincidentally I spent yesterday afternoon messing around with this sort of thing.

Author:  Malabelm [ Fri Jul 09, 2010 10:22 ]
Post subject:  Re: jQuery

I wouldn't mind a copy :)

Author:  markg [ Fri Jul 09, 2010 10:28 ]
Post subject:  Re: jQuery

Ta Grim...

I'm finding this sort of thing to be especially useful for placating directors who insist that their "thing" should be in six inch high green flashing letters in the middle of our intranet home page. Seeing it "fly out" instead usually seems to make them pretty happy.

Author:  Malabelm [ Fri Jul 09, 2010 11:07 ]
Post subject:  Re: jQuery

The jQuery PDF doesn't seem to have packed properly. Can't extract it. Is it just me?

Author:  markg [ Fri Jul 09, 2010 11:12 ]
Post subject:  Re: jQuery

Works fine for me.

Author:  Malabelm [ Fri Jul 09, 2010 11:18 ]
Post subject:  Re: jQuery

markg wrote:
Works fine for me.


I'll download it again. Maybe that messed up.

edit: looks like it only downloaded ~15MB of the 17.9. Stupid Internet.

Author:  GazChap [ Fri Jul 09, 2010 11:30 ]
Post subject:  Re: jQuery

I'll take a link please ;)

Author:  Grim... [ Wed Feb 23, 2011 17:13 ]
Post subject:  Re: jQuery

Two geeky programming threads on the front page, whatever next?

Anyway, why does
Code:
$(window).resize(function() {
    resizeWindows()
});
work, but not
Code:
$(window).resize(resizeWindows());
?

Author:  Squirt [ Wed Feb 23, 2011 17:18 ]
Post subject:  Re: jQuery

I don't know JS too well, but I'm guessing the first passes the reference to the function to your "resize" function, but the second calls resizeWindows and passes the result to resize.

Author:  BikNorton [ Wed Feb 23, 2011 17:18 ]
Post subject:  Re: jQuery

Wouldn't it be
Code:
$(window).resize = resizeWindows;
?

Author:  Grim... [ Wed Feb 23, 2011 17:20 ]
Post subject:  Re: jQuery

BikNorton wrote:
Wouldn't it be
Code:
$(window).resize = resizeWindows;
?

That didn't work.
All I want it to do is fire the 'resizeWindows' function when the window is resized.

Author:  Grim... [ Wed Feb 23, 2011 17:20 ]
Post subject:  Re: jQuery

Squirt wrote:
I don't know JS too well, but I'm guessing the first passes the reference to the function to your "resize" function, but the second calls resizeWindows and passes the result to resize.

It's backward to what you said, but I think that's the case.

Author:  BikNorton [ Wed Feb 23, 2011 17:23 ]
Post subject:  Re: jQuery

Hm. I thought like Squirt - the former sticks a function block in, but the latter doesn't. My experience of this sort of thing is nothing to do with jQuery, just that when making JS objects here people tend to do
Code:
Object.prototype.Function = Object_Function;

function Object_Function() { alert("Gah!"); }
whereas I prefer
Code:
Object.prototype.Function = function() { alert("Gah!"); }

Author:  Squirt [ Wed Feb 23, 2011 17:28 ]
Post subject:  Re: jQuery

One crash course in JS later, does

Code:
$(window).resize(resizeWindows);


as opposed to

Code:
$(window).resize(resizeWindows());


work?

Author:  Malabelm [ Wed Feb 23, 2011 17:36 ]
Post subject:  Re: jQuery

Squirt wrote:
One crash course in JS later, does

Code:
$(window).resize(resizeWindows);


as opposed to

Code:
$(window).resize(resizeWindows());


work?


That would be my suggestion. The callback in your $(window).resize() should take a function name (or anonymous function as in the working example) so leave out the parentheses. I think.

Author:  Grim... [ Wed Feb 23, 2011 17:55 ]
Post subject:  Re: jQuery

It does!

Author:  Squirt [ Wed Feb 23, 2011 18:01 ]
Post subject:  Re: jQuery

:metul:

Author:  Grim... [ Wed Feb 23, 2011 23:42 ]
Post subject:  Re: jQuery

http://facedetection.jaysalvat.com/#

8)

Author:  Malabelm [ Wed Feb 23, 2011 23:46 ]
Post subject:  Re: jQuery

Grim... wrote:
http://facedetection.jaysalvat.com/#

8)


8)

Author:  Grim... [ Wed Feb 23, 2011 23:53 ]
Post subject:  Re: jQuery

http://aquantum-demo.appspot.com/file-upload
8) 8) 8)

I can't even begin to figure out how that works...

Look at the source, yeah yeah

Author:  Grim... [ Wed Feb 23, 2011 23:55 ]
Post subject:  Re: jQuery

Should probably point out that jQuery 1.5 is out, too, but early reports suggest it isn't playing nice with ui, so I'm leaving it alone for now.

Author:  Grim... [ Tue Mar 01, 2011 15:41 ]
Post subject:  Re: jQuery

MY FIRST JQUERY EXTENSION, BY GRIM... AGED 32 AND A HALF

Thoughts?

Author:  Malabelm [ Tue Mar 01, 2011 15:44 ]
Post subject:  Re: jQuery

Grim... wrote:


Quite nice :)

Author:  Trooper [ Tue Mar 01, 2011 17:23 ]
Post subject:  Re: jQuery

That is actually pretty rockin'

I fail a fair amount of captchas due to the characters being incomprehensible to humans and robots alike. That is quite a neat solution.
Google won't like it though, as it doesn't give them free OCR! :D

Author:  Grim... [ Tue Mar 01, 2011 18:02 ]
Post subject:  Re: jQuery

Touch-screens won't like it either, as you can't "drag" things.

Author:  Cras [ Tue Mar 01, 2011 18:04 ]
Post subject:  Re: jQuery

Wait, what? Why not? Surely that's entirely the point of a touchscreen?

Author:  Grim... [ Tue Mar 01, 2011 18:06 ]
Post subject:  Re: jQuery

Craster wrote:
Wait, what? Why not? Surely that's entirely the point of a touchscreen?

"Drags" on most touch devices (phones, iThings) scroll the page.

Author:  Malabelm [ Tue Mar 01, 2011 18:11 ]
Post subject:  Re: jQuery

Have a read of this, Grim...: http://www.sitepen.com/blog/2008/07/10/ ... he-iphone/

It may be useful.

Author:  Cras [ Tue Mar 01, 2011 18:11 ]
Post subject:  Re: jQuery

Oh, true. I was thinking of things like dragging the bird around in Angry Birds, but I guess that's not baked into a scrollable interface like the browser.

Author:  romanista [ Wed Mar 02, 2011 12:01 ]
Post subject:  Re: jQuery

Grim... wrote:


nice, although first time it didn't show the circle..

Author:  Grim... [ Wed Mar 02, 2011 12:17 ]
Post subject:  Re: jQuery

That's weird.

Author:  Wullie [ Wed Mar 02, 2011 13:03 ]
Post subject:  Re: jQuery

Aye, it wouldn't show me anything either & it kept going on about the '90s...
...until I let Noscript allow the script to run ;)

I like it better than them shitey letter number things that nobody can read.

Author:  Grim... [ Wed Mar 02, 2011 13:14 ]
Post subject:  Re: jQuery

I have decided to start a web dev blog, as there aren't many of them about at the moment.

http://www.sadcow.co.uk/

Making the most of that cow ;)

Author:  Malabelm [ Wed Mar 02, 2011 13:16 ]
Post subject:  Re: jQuery

Grim... wrote:
I have decided to start a web dev blog, as there aren't many of them about at the moment.

http://www.sadcow.co.uk/

Making the most of that cow ;)


Good stuff. Let us know when you've put something up and got an RSS feed.

Author:  Grim... [ Wed Mar 02, 2011 13:16 ]
Post subject:  Re: jQuery

I'm fairly certain that's as far as it will get, but you never know.

Author:  itsallwater [ Wed Mar 02, 2011 13:20 ]
Post subject:  Re: jQuery

Grim... wrote:



I like it... very good idea...

One possible hole (and I know it's not yours) but asking to drag X to the Circle and then the image in question being X.png *miiiight* eventually hold some flaws.

Author:  Grim... [ Wed Mar 02, 2011 13:21 ]
Post subject:  Re: jQuery

That won't matter - the fact that the verification code is there in the script is more of an issue ;)
But unless it suddenly takes over the world, I think it'll be okay.

Author:  itsallwater [ Wed Mar 02, 2011 13:30 ]
Post subject:  Re: jQuery

o/

Author:  Malc [ Wed Mar 02, 2011 13:31 ]
Post subject:  Re: jQuery

Once you have dragged the "wrong" icon, you can't change your mind to drag the "right" one.

Malc

Page 1 of 3 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/