...

View Full Version : Simple script problem



NVanderhovel
03-11-2012, 06:04 PM
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:


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

DanInMa
03-11-2012, 06:28 PM
yeah lets see the site. much easier

NVanderhovel
03-11-2012, 06:29 PM
http://kutuluhskateboards.com/skate/crew.html

DanInMa
03-12-2012, 02:23 AM
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_with_Other_Libraries

NVanderhovel
03-12-2012, 04:03 AM
I'll check it out. Thanks!

NVanderhovel
03-12-2012, 02:05 PM
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.

DanInMa
03-12-2012, 03:06 PM
replace:

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


<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

NVanderhovel
03-13-2012, 12:39 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum