Be Excellent To Each Other

And, you know, party on. Dude.

All times are UTC [ DST ]




Reply to topic  [ 120 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: jQuery
PostPosted: Thu Jan 21, 2010 16:21 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Thu Jan 21, 2010 16:25 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
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.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Thu Jan 21, 2010 16:27 
User avatar
That Rev Chap

Joined: 31st Mar, 2008
Posts: 4924
Location: Kent
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.

_________________
InvertY


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Thu Jan 21, 2010 16:30 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
It's a lovely little library. Are you comfortable using CSS selectors?

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Thu Jan 21, 2010 16:36 
User avatar
That Rev Chap

Joined: 31st Mar, 2008
Posts: 4924
Location: Kent
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.

_________________
InvertY


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Thu Jan 21, 2010 16:37 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
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.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Thu Jan 21, 2010 16:45 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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();

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Thu Jan 21, 2010 16:51 
User avatar
That Rev Chap

Joined: 31st Mar, 2008
Posts: 4924
Location: Kent
That seems nice.

_________________
InvertY


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Thu Jan 21, 2010 16:57 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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!

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Thu Jan 21, 2010 16:59 
User avatar
That Rev Chap

Joined: 31st Mar, 2008
Posts: 4924
Location: Kent
I like it!

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

_________________
InvertY


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Fri Jul 09, 2010 10:06 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
Hello!
I have a nice eBook about Jquery, and another about Javascript. They are in both PDF and .mobi formats.

Anyone wany a copy?

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Fri Jul 09, 2010 10:08 
User avatar

Joined: 30th Mar, 2008
Posts: 16652
Yes please Grim... coincidentally I spent yesterday afternoon messing around with this sort of thing.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Fri Jul 09, 2010 10:22 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
I wouldn't mind a copy :)


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Fri Jul 09, 2010 10:28 
User avatar

Joined: 30th Mar, 2008
Posts: 16652
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.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Fri Jul 09, 2010 11:07 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
The jQuery PDF doesn't seem to have packed properly. Can't extract it. Is it just me?


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Fri Jul 09, 2010 11:12 
User avatar

Joined: 30th Mar, 2008
Posts: 16652
Works fine for me.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Fri Jul 09, 2010 11:18 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
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.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Fri Jul 09, 2010 11:30 
User avatar

Joined: 30th Mar, 2008
Posts: 14412
Location: Shropshire, UK
I'll take a link please ;)


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 17:13 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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());
?

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 17:18 
User avatar
Heavy Metal Tough Guy

Joined: 31st Mar, 2008
Posts: 6622
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.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 17:18 
User avatar
Sitting balls-back folder

Joined: 30th Mar, 2008
Posts: 10185
Wouldn't it be
Code:
$(window).resize = resizeWindows;
?


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 17:20 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 17:20 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 17:23 
User avatar
Sitting balls-back folder

Joined: 30th Mar, 2008
Posts: 10185
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!"); }


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 17:28 
User avatar
Heavy Metal Tough Guy

Joined: 31st Mar, 2008
Posts: 6622
One crash course in JS later, does

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


as opposed to

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


work?


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 17:36 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
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.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 17:55 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
It does!

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 18:01 
User avatar
Heavy Metal Tough Guy

Joined: 31st Mar, 2008
Posts: 6622
:metul:


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 23:42 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
http://facedetection.jaysalvat.com/#

8)

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 23:46 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
Grim... wrote:
http://facedetection.jaysalvat.com/#

8)


8)


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 23:53 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Feb 23, 2011 23:55 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Tue Mar 01, 2011 15:41 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
MY FIRST JQUERY EXTENSION, BY GRIM... AGED 32 AND A HALF

Thoughts?

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Tue Mar 01, 2011 15:44 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
Grim... wrote:


Quite nice :)


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Tue Mar 01, 2011 17:23 
User avatar
ugvm'er at heart...

Joined: 4th Mar, 2010
Posts: 22405
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


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Tue Mar 01, 2011 18:02 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
Touch-screens won't like it either, as you can't "drag" things.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Tue Mar 01, 2011 18:04 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49252
Wait, what? Why not? Surely that's entirely the point of a touchscreen?

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Tue Mar 01, 2011 18:06 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Tue Mar 01, 2011 18:11 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
Have a read of this, Grim...: http://www.sitepen.com/blog/2008/07/10/ ... he-iphone/

It may be useful.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Tue Mar 01, 2011 18:11 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49252
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.

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Mar 02, 2011 12:01 
User avatar
Participant in dramatic games

Joined: 30th Mar, 2008
Posts: 4151
Location: United Provinces
Grim... wrote:


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

_________________
XBL: Romanista WiiU: Romanista77 Gamecenter: Romanista345 3DS 0318 8943 6467
Steam: Romanista345 PSN: Romanista345 Switch: 5098 6135 1325 RetroAchievements: Romanista
[img=500x70]https://card.exophase.com/2/0/252928.png?1717524262[/IMG]


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Mar 02, 2011 12:17 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
That's weird.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Mar 02, 2011 13:03 
User avatar

Joined: 27th Jun, 2008
Posts: 6183
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.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Mar 02, 2011 13:14 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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 ;)

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Mar 02, 2011 13:16 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
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.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Mar 02, 2011 13:16 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
I'm fairly certain that's as far as it will get, but you never know.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Mar 02, 2011 13:20 
User avatar
Excellently Membered

Joined: 30th Mar, 2008
Posts: 1268
Location: Behind you!
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.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Mar 02, 2011 13:21 
SupaMod
User avatar
Est. 1978

Joined: 27th Mar, 2008
Posts: 69760
Location: Your Mum
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.

_________________
Grim... wrote:
I wish Craster had left some girls for the rest of us.


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Mar 02, 2011 13:30 
User avatar
Excellently Membered

Joined: 30th Mar, 2008
Posts: 1268
Location: Behind you!
o/


Top
 Profile  
 
 Post subject: Re: jQuery
PostPosted: Wed Mar 02, 2011 13:31 
User avatar
Isn't that lovely?

Joined: 30th Mar, 2008
Posts: 11176
Location: Devon
Once you have dragged the "wrong" icon, you can't change your mind to drag the "right" one.

Malc

_________________
Where's the Kaboom? I was expecting an Earth shattering Kaboom!


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 120 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Columbo, Malc and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search within this thread:
You are using the 'Ted' forum. Bill doesn't really exist any more. Bogus!
Want to help out with the hosting / advertising costs? That's very nice of you.
Are you on a mobile phone? Try http://beex.co.uk/m/
RIP, Owen. RIP, MrC. RIP, Dimmers.

Powered by a very Grim... version of phpBB © 2000, 2002, 2005, 2007 phpBB Group.