Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    Regular Coder
    Join Date
    Apr 2010
    Posts
    220
    Thanks
    116
    Thanked 1 Time in 1 Post

    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):

    <head>
    <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
    </head>
    <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:

    <script type="text/javascript">
    $(document).ready(function() { $('#chkPayment').click(); });
    </script>
    <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.

  • #2
    Regular Coder
    Join Date
    Apr 2010
    Posts
    220
    Thanks
    116
    Thanked 1 Time in 1 Post
    Can anyone see where the problem is?

  • #3
    Regular Coder
    Join Date
    Jan 2006
    Posts
    568
    Thanks
    6
    Thanked 84 Times in 84 Posts
    Have you checked the error console?

  • #4
    Regular Coder
    Join Date
    Apr 2010
    Posts
    220
    Thanks
    116
    Thanked 1 Time in 1 Post
    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)




    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]
    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

  • #5
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    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.

  • #6
    Regular Coder
    Join Date
    Jul 2010
    Location
    St George, UT
    Posts
    138
    Thanks
    6
    Thanked 17 Times in 17 Posts
    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.

  • #7
    Regular Coder
    Join Date
    Apr 2010
    Posts
    220
    Thanks
    116
    Thanked 1 Time in 1 Post
    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?

  • #8
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    852
    Thanks
    173
    Thanked 94 Times in 94 Posts
    Hi

    Just a thought here,

    have you looked at jquery noconflict?

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

    LT

  • #9
    Regular Coder
    Join Date
    Apr 2010
    Posts
    220
    Thanks
    116
    Thanked 1 Time in 1 Post
    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:

    <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

  • #10
    Regular Coder low tech's Avatar
    Join Date
    Dec 2009
    Posts
    852
    Thanks
    173
    Thanked 94 Times in 94 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •