Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Client-side Scripting _ jQuery

Posted by: Dag Jul 22 2023, 07:13 AM

For example, here
http://www.laban.rs/f/w4
I have 2 javascripts (easyzoom.js and jquery). One of them, 'jquery-3.1.1.min.js' should be cleared. I want to use only functions that are necessary for tha page above. Is that possible?

Dag

Posted by: Christian J Jul 22 2023, 07:47 AM

Maybe it's possible, but is it worth all the work? It almost sounds easier to write a new script that doesn't use jQuery from the start.

Posted by: pandy Jul 22 2023, 09:25 AM

Isn't that what the OP wants to do? unsure.gif

Posted by: Christian J Jul 22 2023, 05:17 PM

QUOTE(pandy @ Jul 22 2023, 04:25 PM) *

Isn't that what the OP wants to do? unsure.gif

Since jQuery is made with javascript I guess doing that is always possible.

But I thought Dag wanted to use only those parts of the jQuery library that are needed for the current page.

Posted by: Dag Jul 22 2023, 10:48 PM

QUOTE(Christian J @ Jul 23 2023, 02:17 AM) *

QUOTE(pandy @ Jul 22 2023, 04:25 PM) *

Isn't that what the OP wants to do? unsure.gif

Since jQuery is made with javascript I guess doing that is always possible.
But I thought Dag wanted to use only those parts of the jQuery library that are needed for the current page.


:: needed for the current page.
Exactly.
Javascript is not my strong part. I can't understand that jquery at all. Looks to me that there are one, and only one function. Some kind of javascript classes. I should probably attach sources. Does it worth it? 85 stupid kb versus (probably) 20-30. I need it for many, many pages (large product gallery). Why that guy who made easyzoom didn't extract all necessary code lines as he did partialy?

easyzoom.js
http://www.laban.rs/f/easyzoom-copy.js
jquery-3.1.1.min.js
http://www.laban.rs/f/jquery-3.1.1.min-copy.js

Posted by: Christian J Jul 23 2023, 05:29 AM

QUOTE(Dag @ Jul 23 2023, 05:48 AM) *

I can't understand that jquery at all. Looks to me that there are one, and only one function. Some kind of javascript classes.

That's all I know as well. I think it's meant to be easy to use for people that don't know much javascript.

QUOTE
Does it worth it? 85 stupid kb versus (probably) 20-30. I need it for many, many pages (large product gallery).

I guess it's easier to learn jQuery than than rewriting the whole zoom script. tongue.gif Also, knowing a little jQuery could be useful for other projects, since many websites use it.

If the jQuery library file is cached its extra file size will "average out" if the site visitors view multiple product pages.

Posted by: Dag Jul 23 2023, 07:38 AM

QUOTE(Christian J @ Jul 23 2023) *

Also, knowing a little jQuery could be useful for other projects, since many websites use it.

Thanks but no way. Never was a fun of that language...
QUOTE(Christian J @ Jul 23 2023) *

If the jQuery library file is cached its extra file size will "average out" if the site visitors view multiple product pages.

Yep, I realized that already. But only in case visitor choosed several different products. 50% of time, one product is per one visitor... I'll find some guy to clear it... there are many js ppl arround...

Thanks Christian, thanks Pandy.

This one is interesting:
http://microjs.com/

Or, maybe, just change the script(?)
https://www.youtube.com/watch?v=YenYQKHPtHE

Posted by: Dag Jul 23 2023, 08:41 AM

I can't edit my own post...
If this works, that case is closed.
http://www.laban.rs/f/n1.html

Posted by: Christian J Jul 23 2023, 10:41 AM

QUOTE(Dag @ Jul 23 2023, 02:38 PM) *

QUOTE(Christian J @ Jul 23 2023) *

If the jQuery library file is cached its extra file size will "average out" if the site visitors view multiple product pages.

Yep, I realized that already. But only in case visitor choosed several different products. 50% of time, one product is per one visitor...

Some also recommend loading the jQuery file from a third-party host (for example Google), that way it will be cached from any of the other websites the user has visited before (unless the user clears his cache all the time). Personally I don't like relying on third-party hosts though (for security and privacy reasons).

QUOTE
I can't edit my own post...

Only for one hour.

QUOTE

If this works, that case is closed.
http://www.laban.rs/f/n1.html

That was a little briefer than the jQuery version. wub.gif

Posted by: Dag Jul 23 2023, 11:28 AM

QUOTE(Christian J @ Jul 23 2023, 07:41 PM) *

QUOTE(Dag @ Jul 23 2023, 02:38 PM) *

QUOTE(Christian J @ Jul 23 2023) *

If the jQuery library file is cached its extra file size will "average out" if the site visitors view multiple product pages.

Yep, I realized that already. But only in case visitor choosed several different products. 50% of time, one product is per one visitor...

Some also recommend loading the jQuery file from a third-party host (for example Google), that way it will be cached from any of the other websites the user has visited before (unless the user clears his cache all the time). Personally I don't like relying on third-party hosts though (for security and privacy reasons).

QUOTE
I can't edit my own post...

Only for one hour.

QUOTE

If this works, that case is closed.
http://www.laban.rs/f/n1.html

That was a little briefer than the jQuery version. wub.gif

Can you imagine?? 6 lines of code?! Versus 86kb smile.gif)) Maybe somewere there is some catch... when implement all on the full page, I'll know. Seems that background image is not loaded before mouseover event so, thats good. Meta Preload is nice tag but also eating resources (counted as real request).

:: loading the jQuery file from a third-party host
Never liked that too. Ppl doing stupid things... especially with fonts smile.gif)

Posted by: Julia54 Oct 18 2023, 02:41 AM

I faced a similar kind of issue last time, I am still searching for some proper solution Same issue still no fix to this.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)