SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2010
    Posts
    71
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A problem with jquery and colorbox

    I'm trying to set up colorbox for content that I'm going to bring up with a banner. I'm doing this all in americommerce, and learning my way around it, while also trying to re-acclimate myself with javascript. I set it up a couple of days ago, and it worked perfectly, but today a take a look at it, and nothing. This error comes up in firebug:
    $("a[rel='example1']").colorbox();

    Americommerce already calls up jquery v1.4.2, and through the set-up process of colorbox it says to link to the latest jquery version which is 1.5.2.

    Is it possible that these two are conflicting, that I can get by with only using one? I've tried without the link to 1.5.2 and I have the same problem. As for 1.4.2, I'm not even sure that I can disable it.

    Just for reference, here is the rundown of my javascript code:

    HTML Code:
    <script type="text/javascript" src="/store/inc/jquery.js"></script>
    <script type="text/javascript" src="/store/inc/EnterKeyHandler.js"></script>
    <script type="text/javascript" src="/store/inc/DisableEnter.js"></script>
    <link type="text/css" rel="stylesheet" href="/Store/Templates/Default/Style.aspx?t=9&v=201104042311">
    <link rel="stylesheet" type="text/css" href="Shared/scripts/colorbox/example3/colorbox.css">
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
    <script type="text/javascript" src="Shared/scripts/colorbox/colorbox/jquery.colorbox-min.js"></script>
    <script>
     $(document).ready(function(){
     //Examples of how to assign the ColorBox event to elements
     $("a[rel='example1']").colorbox();
     $("a[rel='example2']").colorbox({transition:"fade"});
     $("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
     $("a[rel='example4']").colorbox({slideshow:true});
     $(".example5").colorbox();
     $(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
     $(".example7").colorbox({width:"80%", height:"80%", iframe:true});
     jquery(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
     $(".example9").colorbox({
     onOpen:function(){ alert('onOpen: colorbox is about to open'); },
     onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
     onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
     onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
    36 onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
     });
    
     //Example of preserving a JavaScript event for inline calls.
     $("#click").click(function(){
     $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
    return false;
     });
    });
    </script> 
    If there isn't a way to easily fix this, is there maybe a better way to achieve the same affects?

  2. #2
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    20
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    make sure your "jquery.js" script is placed AFTER the call for jquery itself. That might be something.


Bookmarks

Posting Permissions

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