views:

196

answers:

3

I have mobile web app and want to use the JQuery Slider control.

http://docs.jquery.com/UI/Slider

However, to do so, it requires the entire JQuery core (29kb compressed & gzipped).

Is it possible to just use Sizzle (4kb) + the JQuery Slider (4kb) control to have a working slider without the need for JQuery core (29kb)?

(I'm trying to cut down as much bloat out as possible since this is for a mobile app, every kb makes a huge difference and if I was able to cut approx 29kb by dumping the jquery core - that would be huge ).

+2  A: 

Unfortunately most JQuery plugins like Slider will need JQuery core itself. The reason they're so small is that JQuery shares a lot of code between plugins.

If you serve the javascript as a statically cached file, users will only need to download it once.

metismo
@metismo - While that's true for most browsers, don't forget there is an increasingly bigger number of developers aiming at mobile devices as well...and it's often not the case (e.g. iPhone wouldn't cache a 29kb file).
Nick Craver
The files served by Google have particularly good cache headers. http://code.google.com/apis/ajaxlibs/
Adam Backstrom
Yes, mobile is what I have in mind
Ted
A: 

You could download the uncompressed version of Jquery and Jquery UI and then delete all method calls that you do not need for the slider by trial and error or source code diving and then compress the smaller file via YUI compressor. Not a simple solution, but the only feasible one (see metismo's answer).

Residuum
Beauty of open source !
Yassir
A: 

No you can't. anyway what is the reason stoping you from using jquery ? if 29kb is too much for your server's bandwidth use a CDN

Yassir
Mobile device. Latency is a huge concern and caching on mobile devices is not as consistent as with typical computer web browser
Ted