tekgrl
asked on
javascript errors
Why am I getting javascript errors? I have a "script.js" that is in the header of all my hTML files. Not every page uses every script, but that's okay, right? Totally confused. script.js attached.
<!-- dropdown nav -->
$(document).ready(function(){
$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled - Adds empty span tag after ul.subnav
$("ul.dropnav li").click(function() { //When trigger is clicked...
//Following events are applied to the subnav itself (moving subnav up and down)
$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
$(this).parent().hover(function() {
}, function(){
$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
});
//Following events are applied to the trigger (Hover events for the trigger)
}).hover(function() {
$(this).addClass("subhover"); //On hover over, add class "subhover"
}, function(){ //On Hover Out
$(this).removeClass("subhover"); //On hover out, remove class "subhover"
});
$('ul.subnav').mouseover(function() {
$("li #top").addClass("selected");
});
$('ul.subnav').mouseout(function() {
$("li #top").removeClass("selected");
});
});
<!-- end dropdown nav -->
<!-- start slider -->
$(document).ready(function(){
$("#slider").easySlider({
prevId: 'previous',
prevText: 'previous',
nextId: 'next',
nextText: 'next',
speed: 1200,
pause: 6000,
auto: false,
continuous: true
});
if($("#slider"))
{
$(document).keydown(function(event){
if(event.keyCode == 37) $("#previous a").click();
if(event.keyCode == 39) $("#next a").click();
});
}
});
<!-- end slider -->
<!-- Start colorbox -->
$(document).ready(function(){
//Examples of how to assign the ColorBox event to elements
$(".group1").colorbox({rel:'group1'});
$(".group2").colorbox({rel:'group2', transition:"fade"});
$(".group3").colorbox({rel:'group3', transition:"none", width:"100", height:"100"});
$(".group4").colorbox({rel:'group4', slideshow:true});
$(".ajax").colorbox();
$(".youtube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
$(".iframe").colorbox({iframe:true, scrolling:false, width:"300px", height:"100%"});
$(".inline").colorbox({inline:true, width:"600px"});
$(".callbacks").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'); },
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;
});
});
<!-- End colorbox -->
what javascript error are you getting?
ASKER
Internal Explorer Script Error
Line 45
Char 3
Object doesn't support this property or method
Line 45
Char 3
Object doesn't support this property or method
do you have a live site that we could look at ?
A couple of things that I noticed.
$(this).parent().find("ul.subnav").slideDown('fast').show();<--you should not need the show, slideDown is already doing that for you.
$(this).parent().hover(function() {
}, function(){
$(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up
});<--since you are not using the mousein function you should probably just do a .mouseout() instead of a hover
ASKER
Sorry, no live site to look at -- privacy issues.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.