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 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Simple script problem

    Hey guys, so I am a designer (not a developer) doing a site for someone.
    I am playing with some simple free javascripts.

    I have lightbox and toggler. Both work great individually.
    They are conflicting and everywhere online says to set the both to onLoad in the body tag.
    Sounds easy enough.

    But I can't seem to figure out the call for this script:
    Code:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="../js/expand.js"></script>
    <script type="text/javascript">
    
    $(function() {
    $("h2.expand").toggler({method: "fadeToggle"});
    });
    //--><!]]>
    </script>
    <body onload="toggler();initLightbox()"> is what is seems like it should be for me. But that isn't working at all.

    Please help!

    I feel like I have tried every possible name with the toggler()...


    If you need more, I can point you to the site itself and you can see all of the (messy) code.

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    yeah lets see the site. much easier

  • #3
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

  • #4
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    ok, your using the prototype framework on the same page. taek a look at this so you can get jQuery and prototype to play nice: http://docs.jquery.com/Using_jQuery_...ther_Libraries

  • Users who have thanked DanInMa for this post:

    NVanderhovel (03-12-2012)

  • #5
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I'll check it out. Thanks!

  • #6
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I wish I understood this stuff.
    This makes sense at a basic level.
    I just don't really know how to change this to fit my needs.

    I really appreciate your help.
    My client has been wondering on my progress and this has kinda stumped me all weekend.

  • #7
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    replace:
    Code:
    <script type="text/javascript" src="other_lib.js"></script>
    <script type="text/javascript" src="jquery.js"></script>
    
    <script type="text/javascript">
      $.noConflict();
      jQuery(document).ready(function($) {
        // Code that uses jQuery's $ can follow here.
    	$.initLightbox()
      });
      // Code that uses other library's $ can follow here.
        $("h2.expand").toggler({method: "fadeToggle"});
    </script>
    with:

    Code:
    <script type="text/javascript">
      $.noConflict();
      jQuery(document).ready(function($) {
        // Code that uses jQuery's $ can follow here.
    
    	    $("h2.expand").toggler({method: "fadeToggle"});
      });
     </script>
    you had the jquery code, outside of the noconflict function so that wouldnt have worked.

    also, $.initLightbox() doesnt appear to be a valid function anywhere. i checked the lightbox documentation. you dont need to initilize ti that I saw. you simply include the script and add rel="lightbox" to and element you want it to work on

  • Users who have thanked DanInMa for this post:

    NVanderhovel (03-13-2012)

  • #8
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Worked like a charm!

    I really appreciate this!
    I have been searching all over to find someone who knows what their talking about.
    I really really do appreciate it.


  •  

    Posting Permissions

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