The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> jQuery, Remove unwanted jQuery functions
Dag
post Jul 22 2023, 07:13 AM
Post #1


Advanced Member
****

Group: Members
Posts: 107
Joined: 24-October 06
Member No.: 549



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 22 2023, 07:47 AM
Post #2


.
********

Group: WDG Moderators
Posts: 9,661
Joined: 10-August 06
Member No.: 7



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jul 22 2023, 09:25 AM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,733
Joined: 9-August 06
Member No.: 6



Isn't that what the OP wants to do? unsure.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 22 2023, 05:17 PM
Post #4


.
********

Group: WDG Moderators
Posts: 9,661
Joined: 10-August 06
Member No.: 7



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dag
post Jul 22 2023, 10:48 PM
Post #5


Advanced Member
****

Group: Members
Posts: 107
Joined: 24-October 06
Member No.: 549



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 23 2023, 05:29 AM
Post #6


.
********

Group: WDG Moderators
Posts: 9,661
Joined: 10-August 06
Member No.: 7



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dag
post Jul 23 2023, 07:38 AM
Post #7


Advanced Member
****

Group: Members
Posts: 107
Joined: 24-October 06
Member No.: 549



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

This post has been edited by Dag: Jul 23 2023, 08:07 AM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dag
post Jul 23 2023, 08:41 AM
Post #8


Advanced Member
****

Group: Members
Posts: 107
Joined: 24-October 06
Member No.: 549



I can't edit my own post...
If this works, that case is closed.
http://www.laban.rs/f/n1.html
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jul 23 2023, 10:41 AM
Post #9


.
********

Group: WDG Moderators
Posts: 9,661
Joined: 10-August 06
Member No.: 7



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Dag
post Jul 23 2023, 11:28 AM
Post #10


Advanced Member
****

Group: Members
Posts: 107
Joined: 24-October 06
Member No.: 549



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)
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Julia54
post Oct 18 2023, 02:41 AM
Post #11





Group: Members
Posts: 1
Joined: 17-October 23
Member No.: 29,077



I faced a similar kind of issue last time, I am still searching for some proper solution Same issue still no fix to this.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 10:38 AM