Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-19-2012, 09:24 PM   PM User | #1
surfbird0713
New Coder

 
Join Date: Jun 2012
Location: South Carolina
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
surfbird0713 is an unknown quantity at this point
Adding any additional JavaScript is breaking functionality within jQuery modal

I have a page created by someone else that contains modal windows, and each modal window has links/images that display on hover. FYI, I have a very limited understanding of JavaScript and jQuery.

I want to add Google Analytics tags to the links in the modal windows. Usually, I just add:

Code:
onclick="_gaq.push(['_trackEvent','Parameter 1', 'Parameter 2', 'Parameter 3']);"
directly to the anchor tag, but whenever I add the code to the anchor tag in the HTML, the jQuery stops working. The modal windows work correctly on this link: http://cookware.lecreuset.com/cookwa...10151_-1_20002

and you can see what I mean by "stops working" on the following link - the items within the list tags are no longer being populated, which means the icons don't show up and the new content that displays on hover can't be accessed: http://cookware.lecreuset.com/cookwa...10151_-1_20002

Since most of the links are created in the jQuery, I started by trying to add the Google Tag via .click, .attr, .on and .bind with no luck. The link above shows you my attempt with the .click function (search for CIGuide and you'll find it in the source), but it breaks in the same way no matter what JavaScript I add to the page.

After I wasn't able to get either of those two things to work, I decided to try a simple alert on the page outside of all the content I was provided, with it's own JavaScript tags, just to see if I could get that to work. It worked perfectly, but the modal functionality still broke.

I have been able to successfully add the Google Tags to the anchor in the top navigation, and to the arrows on the left and right side of the page. But anytime I try to tag anything else, it breaks.

The agency I'm working with is able to add the google tag to the anchor with no issue when they test it on their server, and I am able to see the event fire if I test it on my local machine. I have to assume there is a problem on my server or with OpenCMS. However, I don't see any error messages in any browser/debugger, and I have validated my script additions with JSLint, and everything checks out.

This is driving me nuts! Can anyone help me figure out why this won't work and how I can add event tags to the page?
surfbird0713 is offline   Reply With Quote
Old 12-20-2012, 07:48 AM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,530
Thanks: 0
Thanked 503 Times in 494 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
What does the error console say? It usually identifies what has stopped the script from working.

If that doesn't help then turn on the debugger in your browser (F12 in IE, chrome, Safari and Opera).
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline   Reply With Quote
Old 12-20-2012, 03:00 PM   PM User | #3
surfbird0713
New Coder

 
Join Date: Jun 2012
Location: South Carolina
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
surfbird0713 is an unknown quantity at this point
I'm not seeing any errors, that's the frustrating part. I have checked in FF, Chrome, and I have the script error/debugger on in IE and it doesn't register any errors.

Last night I also tried changing the _gaq.push call to console.log just to see if that would work, but it still breaks it.
surfbird0713 is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript, jquery

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:59 PM.


Advertisement
Log in to turn off these ads.