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

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 07-17-2010, 03:33 AM   PM User | #1
BlackReef
Regular Coder

 
Join Date: Apr 2010
Posts: 193
Thanks: 100
Thanked 1 Time in 1 Post
BlackReef is an unknown quantity at this point
Having a Javascript conflict of some sort on a website...not working properly (help)

Hello,

I am building a shopping cart website that is using a mega javascript dropdown menu.

Everything was working fine until you get to the checkout page on the website. The checkout page has this accordian / spry deal where customers can checkout on one page. You can view it here:


http://gem-tech.com.mytempweb.com/store/pc/onepagecheckout.asp


If I take the menu code out of the header.asp file, then the checkout page works just fine. But if I put the menu code back in, then the checkout page stops working.

Here is the menu code (simplified it a bit for this thread):

Quote:
<head>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
Quote:
<body><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>

<script type="text/javascript" src="jquery.hoverIntent.minified.js"></script>
<script type="text/javascript">
$(document).ready(function() {


function megaHoverOver(){
$(this).find(".sub").stop().fadeTo('fast', 1).show();

//Calculate width of all ul's
(function($) {
jQuery.fn.calcSubWidth = function() {
rowWidth = 0;
//Calculate row
$(this).find("ul").each(function() {
rowWidth += $(this).width();
});
};
})(jQuery);

if ( $(this).find(".row").length > 0 ) { //If row exists...
var biggestRow = 0;
//Calculate each row
$(this).find(".row").each(function() {
$(this).calcSubWidth();
//Find biggest row
if(rowWidth > biggestRow) {
biggestRow = rowWidth;
}
});
//Set width
$(this).find(".sub").css({'width' :biggestRow});
$(this).find(".row:last").css({'margin':'0'});

} else { //If row does not exist...

$(this).calcSubWidth();
//Set Width
$(this).find(".sub").css({'width' : rowWidth});

}
}

function megaHoverOut(){
$(this).find(".sub").stop().fadeTo('fast', 0, function() {
$(this).hide();
});
}


var config = {
sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
interval: 100, // number = milliseconds for onMouseOver polling interval
over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
timeout: 500, // number = milliseconds delay before onMouseOut
out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};

$("ul#topnav li .sub").css({'opacity':'0'});
$("ul#topnav li").hoverIntent(config);



});



</script>
</body>
And there are two things of script on the onepagecheckout.asp page as well. Here they are:

Quote:
<script type="text/javascript">
$(document).ready(function() { $('#chkPayment').click(); });
</script>
Quote:
<script type="text/javascript">
var acc1 = new Spry.Widget.Accordion("acc1", { useFixedPanelHeights: false, enableAnimation: false });
var currentPanel = 0;

<% if session("idCustomer")>"0" then
session("OPCstep")=2
else
session("OPCstep")=0
end if %>

//* Find Current Panel
<% if len(Session("CurrentPanel"))=0 AND pcv_strPayPanel="" then %>

<% if session("idCustomer")>"0" then %>
acc1.openPanel('opcLogin');
GoToAnchor('opcLoginAnchor');
$('#LoginOptions').hide();
$('#ShippingArea').hide();
$('#BillingArea').show();
<% else %>
$('#LoginOptions').show();
$('#acc1').hide();
<% end if %>

<% else %>

<% If pcv_strPayPanel = "1" Then %>
$(document).ready(function() {
$('#LoginOptions').hide();
pcf_LoadPaymentPanel();
});
<% Else %>
acc1.openPanel('opcLogin');
$('#LoginOptions').hide();
$('#ShippingArea').hide();
$('#BillingArea').show();
<% End If %>

<% end if %>

GoToAnchor('opcLoginAnchor');

function openme(pNumber) {
acc1.openPanel(pNumber);
}
function toggle(pNumber) {
var ele = acc1.getCurrentPanel();
var panelNumber = acc1.getPanelIndex(ele);
if (panelNumber == pNumber) {
acc1.closePanel(pNumber);
} else {
acc1.openPanel(pNumber);
}
}
function togglediv(id) {
var div = document.getElementById(id);
if(div.style.display == 'block')
div.style.display = 'none';
else
div.style.display = 'block';
}

function win(fileName)
{
myFloater=window.open('','myWindow','scrollbars=yes,status=no,width=300,height=250')
myFloater.location.href=fileName;
}

</script>
Any help would be GREATLY appreciated,

Thank you

Last edited by BlackReef; 07-18-2010 at 12:35 AM..
BlackReef is offline   Reply With Quote
Old 07-18-2010, 12:32 AM   PM User | #2
BlackReef
Regular Coder

 
Join Date: Apr 2010
Posts: 193
Thanks: 100
Thanked 1 Time in 1 Post
BlackReef is an unknown quantity at this point
Can anyone see where the problem is?
BlackReef is offline   Reply With Quote
Old 07-18-2010, 01:03 AM   PM User | #3
gusblake
Regular Coder

 
Join Date: Jan 2006
Posts: 568
Thanks: 6
Thanked 84 Times in 84 Posts
gusblake is on a distinguished road
Have you checked the error console?
gusblake is offline   Reply With Quote
Old 07-20-2010, 02:51 AM   PM User | #4
BlackReef
Regular Coder

 
Join Date: Apr 2010
Posts: 193
Thanks: 100
Thanked 1 Time in 1 Post
BlackReef is an unknown quantity at this point
Quote:
Originally Posted by gusblake View Post
Have you checked the error console?
I just checked it today. Here is a screenshot of what it came up with (2 errors)




Quote:
Error: uncaught exception: [Exception... "'[JavaScript Error: "b.value is null" {file: "chrome://google-toolbar-lib/content/toolbar.js" line: 2513}]' when calling method: [nsIFactory::createInstance]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)" location: "JS frame :: chrome://google-toolbar/content/gtb.js :: anonymous :: line 81" data: yes]
Quote:
Error: $("ul#topnav li").hoverIntent is not a function
Source File: http://gem-tech.com.mytempweb.com/st...ginSubmit.y=15
Line: 205
Not quite sure what it means. I google'd it, and one of the solutions was to rearrange the order of the js calls in the header.asp, but that did not work for me
BlackReef is offline   Reply With Quote
Old 07-20-2010, 12:20 PM   PM User | #5
Spudhead
Senior Coder

 
Spudhead's Avatar
 
Join Date: Jun 2002
Location: London, UK
Posts: 1,856
Thanks: 8
Thanked 110 Times in 109 Posts
Spudhead is on a distinguished road
It means the function hoverIntent hasn't been defined. First thing I'd check is that the JS file jquery.hoverIntent.minified.js is actually being found.
Spudhead is offline   Reply With Quote
Old 07-20-2010, 03:03 PM   PM User | #6
wildreason
Regular Coder

 
Join Date: Jul 2010
Location: St George, UT
Posts: 139
Thanks: 6
Thanked 17 Times in 17 Posts
wildreason is on a distinguished road
If you are using more than one framework it is likely they have defined identically named functions that serve different purposes.

If it's an option, try to find a solution for what you are trying to do using just one framework.
wildreason is offline   Reply With Quote
Old 07-21-2010, 01:04 AM   PM User | #7
BlackReef
Regular Coder

 
Join Date: Apr 2010
Posts: 193
Thanks: 100
Thanked 1 Time in 1 Post
BlackReef is an unknown quantity at this point
Quote:
Originally Posted by Spudhead View Post
It means the function hoverIntent hasn't been defined. First thing I'd check is that the JS file jquery.hoverIntent.minified.js is actually being found.
Ok, well just to make sure, I put the full path of the .js file in the header.asp file and uploaded it. I believe the file is being found as this is the exact path that is currently in the header.asp file:

http://gem-tech.com.mytempweb.com/st...nt.minified.js

So is it safe to assume this is not the problem at this point?

Quote:
Originally Posted by wildreason View Post
If you are using more than one framework it is likely they have defined identically named functions that serve different purposes.

If it's an option, try to find a solution for what you are trying to do using just one framework.
Well, I will be honest - this is a bit above my head. I understand that 'framework' means different versions of JS, but thats about the extent of my knowledge.

I basically followed a Mega drop down tutorial to build the menu, and the Javascript in the onepagecheckout.asp page was already pre-coded.

Like I mentioned, everything works fine on the checkout page if I remove the Javascript for the menu in the header.asp file.

Thank you very much for your responses. Any idea on what to do next?
BlackReef is offline   Reply With Quote
Old 07-21-2010, 01:54 AM   PM User | #8
low tech
Regular Coder

 
low tech's Avatar
 
Join Date: Dec 2009
Posts: 740
Thanks: 149
Thanked 67 Times in 67 Posts
low tech is on a distinguished road
Hi

Just a thought here,

have you looked at jquery noconflict?

http://api.jquery.com/jQuery.noConflict/

LT
low tech is offline   Reply With Quote
Old 07-21-2010, 10:44 PM   PM User | #9
BlackReef
Regular Coder

 
Join Date: Apr 2010
Posts: 193
Thanks: 100
Thanked 1 Time in 1 Post
BlackReef is an unknown quantity at this point
Quote:
Originally Posted by low tech View Post
Hi

Just a thought here,

have you looked at jquery noconflict?

http://api.jquery.com/jQuery.noConflict/

LT
Thanks LT for the help. That link was working last night when I checked it, but I'm getting a 'DB error' now.

Regardless, I did a Google search on jquery noconflict, and I found some example code. I added this to before the </head> tag, but all it did was cause the site not to load...Im sure Im missing something though:

Quote:
<script>
jQuery.noConflict();
// Use jQuery via jQuery(...)
jQuery(document).ready(function(){
jQuery("div").hide();
});
// Use Prototype with $(...), etc.
$('someid').hide();
</script>
I found this code at this site: http://docs.jquery.com/Using_jQuery_with_Other_Libraries
BlackReef is offline   Reply With Quote
Old 07-22-2010, 12:03 AM   PM User | #10
low tech
Regular Coder

 
low tech's Avatar
 
Join Date: Dec 2009
Posts: 740
Thanks: 149
Thanked 67 Times in 67 Posts
low tech is on a distinguished road
Hi

May I suggest that you try the 'javascript frameworks' part of this forum. They deal with the the jquery framework etc.

I think you will have a much better chance of solving your problem there.

LT
In order to not double post, You may need to ask a moderator to move this thread.
low tech is offline   Reply With Quote
Reply

Bookmarks

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 06:07 AM.


Advertisement
Log in to turn off these ads.