Build Your Own Business Website header image

Welcome to our Members Only Forum

You are welcome to view the content on our Forum, just scroll down to view this forum post.
If you like what you find and want to be able to post a question, please check out our subscription options.
Please feel free to search the forum using either the Google Site Search above or the forum search below.

Avatar
Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Question About the use of External JQuery on a Genesis site
Avatar
Carolin
Arizona
Member
Members

Community Member
Forum Posts: 984
Member Since:
February 14, 2012
sp_UserOfflineSmall Offline
1
November 2, 2014 - 2:18 pm
sp_Permalink sp_Print sp_EditHistory

Rick --

I made a screencast with my question as it should better explain what I trying to figure out.

Basically I have acquired this client site that I did not construct from the start. I was brought in after the owner ended up with an AWOL designer to put the random new photos on it, do the major WP upgrades, etc -- nothing too major. Just to take it under my wing and be their point person for their IDX Broker plugin, and any occasional need that arises.

It is a Genesis site that is using a version of the Hans theme that was modified by the now AWOL original designer.

I am trying to determine, so I understand what is happening, some use of JQuery that is being used in several widgets and is calling on an external stylesheet that seems to be associated with this location. Is the call to some external stylesheet a normal practice for something like this?

I am not sure where to even go to read more to try and figure out why they are using some external style sheet and the other issues that may be happening here.

As I said in the screencast, there is nothing, at the moment that seems to be broken with this issue, but I would like to have some understanding of the intend of why this JQuery may be being used on the site in this manner.

Any thought you have on this would be appreciated. Thanks much.

Carolin Benjamin WordPress Design & Consulting

Provide ‘white label’ support to web and advertising agencies that need extra help from time to time -
Also consulting, design & web construction for businesses, non-profits & sole-practitioners

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
2
November 4, 2014 - 9:53 am
sp_Permalink sp_Print

First off - this would be an excellent question for a Wednesday session.

There is no fundamental reason why you need to host all of your javascript resources - although CSS is VERY EASILY added to the Theme CSS and thus will make the site run faster.

However - the way the previous developer is doing this is wrong and could break other things in the site.

For example - one should NEVER hard code a reference to jQuery - ESPECIALLY inside of a widget.  If you need jQuery, and it isn't already loaded by something else then you need to "enqueue" jQuery rather than hard coding a reference to it.

If you are ABSOLUTELY CERTAIN that jQuery won't be called by the theme or some other plugin then the right way to add it to a Genesis site is to use the head scripts section of Theme Settings.  However - this still involves hardcoding the reference, which could break something one a plugin is installed that calls jQuery properly. 

Avatar
Carolin
Arizona
Member
Members

Community Member
Forum Posts: 984
Member Since:
February 14, 2012
sp_UserOfflineSmall Offline
3
November 4, 2014 - 10:14 am
sp_Permalink sp_Print

Could we cover this in the AM Q&A this Wed then - tomorrow ?

that would be terrific -

BTW- I have this site also cloned on a sandbox server if we need to look at something live and do not want to disturb the live site.

 

Thanks Rick -- I had a feeling the way this was now handled was not the best, but was not sure what to do about it.

Carolin Benjamin WordPress Design & Consulting

Provide ‘white label’ support to web and advertising agencies that need extra help from time to time -
Also consulting, design & web construction for businesses, non-profits & sole-practitioners

Avatar
Carolin
Arizona
Member
Members

Community Member
Forum Posts: 984
Member Since:
February 14, 2012
sp_UserOfflineSmall Offline
4
February 7, 2015 - 3:25 pm
sp_Permalink sp_Print sp_EditHistory

Rick ...

The code you helped me with on this site that had been improperly input by the former developer, before I acquired the site has been working fine since we worked on it.

But I recently had a situation where I upgraded the Soliloquy slider plugin on site and while the upgrade seemed fine, in my review I noticed that the slider had stopped sliding and was presenting as a single static image on the site.

I contacted Soliloquy support and they initially did not have any idea, but then asked for some log-on info, so I let them onto the sandbox site to check things out and the tech came back and told me:

The slider's not rotating due to an error generated by the script you've added to the Home Sidebar Search text widget. It's producing an "Uncaught TypeError: undefined is not a function" error for the line containing "slider.slider({".

Once this is resolved the homepage slider should function as expected.

That said, I am over my present skill set in evaluating the relationship to the script we added and how it would affect the Soliloquy slider, I am attaching a .txt file here of the script for you to take a look at.

I honestly do think the slider was rotating images fine on the site until I upgraded the Soliloquy plugin last week, so what they are suggesting to me is a bit questionable. The revised script was put into place on the site back in November which is more than 2 months ago, and the plugin upgrade was done last week.

If this is indeed the culprit and since the script has seemed to work otherwise ok on the site, I imagine the client will be ok with there only being a static image, instead of his original slider of 6 images on the front page.

Does what the Soliloquy techs are saying about this issue make sense to you?

Carolin Benjamin WordPress Design & Consulting

Provide ‘white label’ support to web and advertising agencies that need extra help from time to time -
Also consulting, design & web construction for businesses, non-profits & sole-practitioners

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
5
February 8, 2015 - 6:40 am
sp_Permalink sp_Print sp_EditHistory

Change line 169 of that code to:

jQuery('#widget').draggable();

In other words - replace the $ with jQuery 

Avatar
Carolin
Arizona
Member
Members

Community Member
Forum Posts: 984
Member Since:
February 14, 2012
sp_UserOfflineSmall Offline
6
February 11, 2015 - 3:38 pm
sp_Permalink sp_Print sp_EditHistory

Rick..

I'm confused - when I take the referenced code (in the .txt file uploaded above) and put it into NetBeans so I can see numbered lines, and look at line #169 it is a blank line?

Did you mean some other line of code other than 169?

 

Line #56 has the code --- jQuery('#widget').draggable(); 

which seems is what you were suggesting a line was is be changed to -- but it already exists like that?

 

I have been all over the 273 lines of code several times to see if I could locate something like you suggested I look for in another line other than #169 and I am not seeing it - I am stumped?

(And as a note -- if this is an issue that will suck up a ton of time to figure out, I can get the client to live with a single image on his front page instead of a slider I am pretty sure.)

Carolin Benjamin WordPress Design & Consulting

Provide ‘white label’ support to web and advertising agencies that need extra help from time to time -
Also consulting, design & web construction for businesses, non-profits & sole-practitioners

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
7
February 13, 2015 - 11:39 am
sp_Permalink sp_Print

Actually - that code is showing up in the home search box widget.  Directly below the jQuery for the sort the slider by price range.

Take a look at the code that was entered into that text widget.

Avatar
Carolin
Arizona
Member
Members

Community Member
Forum Posts: 984
Member Since:
February 14, 2012
sp_UserOfflineSmall Offline
8
February 14, 2015 - 8:28 pm
sp_Permalink sp_Print

Rick ..

I looked at the code again on this sandbox version of the client site so I could test and not mess up something live.

I found the code you are referencing in your last suggestion in 3 separate side bar widget areas in a text box --

- Listings Sidebar

- Blog Sidebar

- Page side bar

So in all 3 of these I changed the code, replacing the $ with jQuery, to the new code below-

<script>jQuery ('#widget').draggable();</script>

Then on the sidebar widget area text called

- Home Sidebar Search

in the text widget for the same search function I found some other code, in the same place as the code I was changing, on the other areas that seemed suspect -- and I only mean suspect in that it is code to perform the same search function there as on the other sidebar and widget areas.

The old code in the Home Sidebar Search was

<script>jQuery(document).ready(function(){jQuery('#widget').draggable();
})</script>

I replaced it to

<script>jQuery ('#widget').draggable();</script>

After editing the code and in review of the site, all of the search areas seem to see be performing as desired.

However, the Solilquy slider is still only showing 1 image, and not behaving as a slider. So apparently Solilquy is still not playing well with something else on the site, or else Solilquy needs another upgrade that is not available.

I guess, thank goodness, the site looks ok , with only 1 static image.

I would like to get to the bottom of it however, if it is doable.

Carolin Benjamin WordPress Design & Consulting

Provide ‘white label’ support to web and advertising agencies that need extra help from time to time -
Also consulting, design & web construction for businesses, non-profits & sole-practitioners

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
9
February 15, 2015 - 8:16 am
sp_Permalink sp_Print

Both of the places you changed that still have an error in them.  There can't be a space between "jQuery" and "(".

Also, there still is another javascript error in that code.

Take the widget out of the page and see if the slider works.  

Avatar
Carolin
Arizona
Member
Members

Community Member
Forum Posts: 984
Member Since:
February 14, 2012
sp_UserOfflineSmall Offline
10
February 15, 2015 - 2:44 pm
sp_Permalink sp_Print

Thanks Rick .. I'll keep on looking at this issue.

Clearly there are a couple of important lessons for me in this whole situation  -- confused

1 - I need to take a Javascript class sooner than later, so I have a better clue what I am looking for and needing to do as I sift through javascript code - I should already know this type of thing I am sure -- such as, ie, when you say "There can’t be a space between “jQuery” and “(“. "

2 - And chuckle  - to be cautious of taking on client sites where I am not actually creating the website and know what went into it, but instead the site was originally made by a developer who went AWOL. And I am going to need to try to sift thru code they did every time I end up doing upgrades, to figure out what they did, or why when something quits working. Maybe the developer went AWOL for a reason, as in "oh this is not going to work over time - I am outta here". smileThis site for sure has already had a number of code issues come up at random times that make upgrading it never straightforward.

Thanks much for all your help and patience as I keeping learning.

Carolin Benjamin WordPress Design & Consulting

Provide ‘white label’ support to web and advertising agencies that need extra help from time to time -
Also consulting, design & web construction for businesses, non-profits & sole-practitioners

Avatar
Rick Anderson
Desert Hot Springs, CA
Admin
Forum Posts: 13637
Member Since:
November 8, 2009
sp_UserOfflineSmall Offline
11
February 15, 2015 - 2:48 pm
sp_Permalink sp_Print

For you... Anything!

Avatar
Carolin
Arizona
Member
Members

Community Member
Forum Posts: 984
Member Since:
February 14, 2012
sp_UserOfflineSmall Offline
12
February 15, 2015 - 3:05 pm
sp_Permalink sp_Print

Thanks Rick cool

Carolin Benjamin WordPress Design & Consulting

Provide ‘white label’ support to web and advertising agencies that need extra help from time to time -
Also consulting, design & web construction for businesses, non-profits & sole-practitioners

Forum Timezone: America/Los_Angeles

Most Users Ever Online: 228

Currently Online:
8 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Keith W Jones: 1444

Brian Tozer: 1004

Carolin: 984

Heidi Hafner: 509

John Cunningham: 423

Reece Morrel: 353

Newest Members:

saamkrish

volminFL

soundpilot

digitalaerolus

emma62755

sharonmarks

Forum Stats:

Groups: 8

Forums: 46

Topics: 7004

Posts: 34849

 

Member Stats:

Guest Posters: 6

Members: 6765

Moderators: 2

Admins: 2

Administrators: Rick Anderson, Rick Anderson

Moderators: Pierre Cote, Laura Nugent