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 03-11-2012, 06:04 PM   PM User | #1
NVanderhovel
New to the CF scene

 
Join Date: Mar 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
NVanderhovel is an unknown quantity at this point
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.
NVanderhovel is offline   Reply With Quote
Old 03-11-2012, 06:28 PM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
yeah lets see the site. much easier
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 03-11-2012, 06:29 PM   PM User | #3
NVanderhovel
New to the CF scene

 
Join Date: Mar 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
NVanderhovel is an unknown quantity at this point
http://kutuluhskateboards.com/skate/crew.html
NVanderhovel is offline   Reply With Quote
Old 03-12-2012, 02:23 AM   PM User | #4
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
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
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Users who have thanked DanInMa for this post:
NVanderhovel (03-12-2012)
Old 03-12-2012, 04:03 AM   PM User | #5
NVanderhovel
New to the CF scene

 
Join Date: Mar 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
NVanderhovel is an unknown quantity at this point
I'll check it out. Thanks!
NVanderhovel is offline   Reply With Quote
Old 03-12-2012, 02:05 PM   PM User | #6
NVanderhovel
New to the CF scene

 
Join Date: Mar 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
NVanderhovel is an unknown quantity at this point
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.
NVanderhovel is offline   Reply With Quote
Old 03-12-2012, 03:06 PM   PM User | #7
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
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
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Users who have thanked DanInMa for this post:
NVanderhovel (03-13-2012)
Old 03-13-2012, 12:39 AM   PM User | #8
NVanderhovel
New to the CF scene

 
Join Date: Mar 2012
Posts: 5
Thanks: 2
Thanked 0 Times in 0 Posts
NVanderhovel is an unknown quantity at this point
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.
NVanderhovel 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 12:20 PM.


Advertisement
Log in to turn off these ads.