Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

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 05-03-2012, 07:47 PM   PM User | #1
MasterRenny
New Coder

 
Join Date: Oct 2011
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
MasterRenny is an unknown quantity at this point
Syntax error problem

Not sure if this is the right place but im having problems getting this to work

PHP Code:
        // superFish
        
$('ul.sf-menu').superfish(); 
            
autoArrowstrue,
            
animation:   {opacity:'show',height:'show'},
                
//remove current menu class from drop-downs
        
$("ul.sf-menu ul li").removeClass("current-menu-item");

        });
    }); 
on the animation line there is the error, if i remove the removeClass line it works fine and adds the little arrow to drop down menu, but if i add the removeClass line the script dont work and it stops all my other scripts from working.

Here it is in full

PHP Code:
<script type="text/javascript">  
jQuery(function($){
      $(
document).ready(function() {
                  
          
// Horizontal Sliding Tabs
          
$('div#st_horizontal').slideTabs({              
            
// Options              
            
contentAnim'fade',
            
autoHeighttrue,
            
contentAnimTime600,
            
contentEasing'easeInOutExpo',
            
tabsAnimTime300            
          
});                            
      
      });        
    
        
// superFish
        
$('ul.sf-menu').superfish(); 
            
autoArrowstrue,
            
animation:   {opacity:'show',height:'show'},
                
//remove current menu class from drop-downs
        
$("ul.sf-menu ul li").removeClass("current-menu-item");

        });
    });

   
// ToolTip Facebook style
    
  
$(function() {
    
      $(
'#fb').tipsy({gravity's'});
    $(
'#twitter').tipsy({gravity's'});
    $(
'#pin').tipsy({gravity's'});
    $(
'#yt').tipsy({gravity's'});
    $(
'#email').tipsy({gravity's'});
    $(
'#rss').tipsy({gravity's'});
  });
</script> 

Though im not a wiz at javascript and know very little on structure and how syntaxs..etc work

Kind regards,
Renny

Last edited by MasterRenny; 05-03-2012 at 08:27 PM..
MasterRenny is offline   Reply With Quote
Old 05-03-2012, 08:00 PM   PM User | #2
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
wrong place buddy- you want javascript section of forum A mod will move this thread- please don't cross post
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote
Users who have thanked alykins for this post:
MasterRenny (05-03-2012)
Old 05-03-2012, 08:28 PM   PM User | #3
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,601
Thanks: 2
Thanked 397 Times in 390 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Moved
Inigoesdr is offline   Reply With Quote
Old 05-03-2012, 08:31 PM   PM User | #4
MasterRenny
New Coder

 
Join Date: Oct 2011
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
MasterRenny is an unknown quantity at this point
Quote:
Originally Posted by Inigoesdr View Post
Moved
Thank you
MasterRenny is offline   Reply With Quote
Old 05-03-2012, 08:34 PM   PM User | #5
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Syntax is the most essential part of a programming language so you should start to learn about it.

Generally you should check that every opening bracket/parenthesis has a corresponding closing one and vice versa.

You want to call superfish() with parameters, but before you give any parameter, you already close the "parameter parentheses". It should be more like
Code:
        $('ul.sf-menu').superfish({ 
            autoArrows: true,
            animation:   {opacity:'show',height:'show'}
        });
but I dunno if this will work, though. Because on top of the Syntax, also the documentation of your frameworks and plug-ins is important. And I don't know anything about the superfish documentation ....
devnull69 is offline   Reply With Quote
Old 05-03-2012, 08:36 PM   PM User | #6
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 950
Thanks: 7
Thanked 98 Times in 98 Posts
WolfShade is an unknown quantity at this point
I could be wrong, but I think the comma at the end of the last parameter might be causing your issue, as well.

^_^
WolfShade is offline   Reply With Quote
Old 05-03-2012, 08:45 PM   PM User | #7
MasterRenny
New Coder

 
Join Date: Oct 2011
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
MasterRenny is an unknown quantity at this point
The script works fine until i added $("ul.sf-menu ul li").removeClass("current-menu-item"); which i need in to be able to stop it from showing the blue hover when you go though the menu


www.masterrenny.com is where im using it

as you can see its removing the class, but it isnt allowing//showing the superfish arrow
MasterRenny is offline   Reply With Quote
Old 05-03-2012, 08:45 PM   PM User | #8
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Unfortunately, this is wrong. Although it should be common sense to not use a comma after the final entry of an object literal, every current Javascript engine will just ignore it :-)
devnull69 is offline   Reply With Quote
Old 05-03-2012, 08:51 PM   PM User | #9
MasterRenny
New Coder

 
Join Date: Oct 2011
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
MasterRenny is an unknown quantity at this point
But even without it i cant get it to work
MasterRenny is offline   Reply With Quote
Old 05-03-2012, 08:51 PM   PM User | #10
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Quote:
Originally Posted by MasterRenny View Post
The script works fine until i added $("ul.sf-menu ul li").removeClass("current-menu-item");
Sorry, but this is not possible, because even without this line the code is just wrong
Code:
jQuery(function($){
      $(document).ready(function() {
                  
          // Horizontal Sliding Tabs
          $('div#st_horizontal').slideTabs({              
            // Options              
            contentAnim: 'fade',
            autoHeight: true,
            contentAnimTime: 600,
            contentEasing: 'easeInOutExpo',
            tabsAnimTime: 300            
          });                            
      
      });        
    
        // superFish
        $('ul.sf-menu').superfish(); 
            autoArrows: true,
            animation:   {opacity:'show',height:'show'},
                //remove current menu class from drop-downs

        });
    });

   // ToolTip Facebook style
    
  $(function() {
    
      $('#fb').tipsy({gravity: 's'});
    $('#twitter').tipsy({gravity: 's'});
    $('#pin').tipsy({gravity: 's'});
    $('#yt').tipsy({gravity: 's'});
    $('#email').tipsy({gravity: 's'});
    $('#rss').tipsy({gravity: 's'});
  });
There are 23 opening and 24 closing parentheses
There are 11 opening and 12 closing curly brackets

This would never ever work!
devnull69 is offline   Reply With Quote
Old 05-03-2012, 08:55 PM   PM User | #11
MasterRenny
New Coder

 
Join Date: Oct 2011
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
MasterRenny is an unknown quantity at this point
Urgh not one of you are helping your all just saying the same thing...:/
MasterRenny is offline   Reply With Quote
Old 05-03-2012, 09:07 PM   PM User | #12
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
This should make you start thinking ... you know like a motorist driving against the traffic and every other driver is flashing the lights at him ... you are doing some very essential things very wrong and you need to do a U turn
devnull69 is offline   Reply With Quote
Old 05-03-2012, 09:09 PM   PM User | #13
MasterRenny
New Coder

 
Join Date: Oct 2011
Posts: 15
Thanks: 4
Thanked 0 Times in 0 Posts
MasterRenny is an unknown quantity at this point
No because your all missing the point, this;

PHP Code:
        // superFish
        
$('ul.sf-menu').superfish(); 
            
autoArrowstrue,
            
animation:   {opacity:'show',height:'show'}
                
//remove current menu class from drop-downs
        
$("ul.sf-menu ul li").removeClass("current-menu-item");

        });
    }); 
Is what im having problems with getting working, the rest of the code isnt the problem and actually works fine if i remove this part of the code from the file
MasterRenny is offline   Reply With Quote
Old 05-03-2012, 09:12 PM   PM User | #14
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
What does the superfish documentation tell you? Can you at least point us to the site where you got it from?
devnull69 is offline   Reply With Quote
Old 05-03-2012, 11:30 PM   PM User | #15
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,455
Thanks: 0
Thanked 498 Times in 490 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
Quote:
Originally Posted by MasterRenny View Post
No because your all missing the point, this;

PHP Code:
        // superFish
        
$('ul.sf-menu').superfish(); 
            
autoArrowstrue,
            
animation:   {opacity:'show',height:'show'}
                
//remove current menu class from drop-downs
        
$("ul.sf-menu ul li").removeClass("current-menu-item");

        });
    }); 
Is what im having problems with getting working, the rest of the code isnt the problem and actually works fine if i remove this part of the code from the file
That code is completely invalid syntax - the only reason the autoArrows and animation lines don't throw an error before you added the extra line is because JavaScript is able to interpret them in a completely different way to how you expect.

autoArrows: true, <== a label of "autoArrows" followed by a statement that is true - the true result is discarded because it isn't assigned to anything

animation: {opacity:'show',height:'show'} <== a label of "animation" followed by the creation of an anonymous object with opacity and height properties. The anonymous object is also immediately discarded because it isn't assigned to anything.

Commenting out those two lines will not affect the original code.

What you need to do BEFORE adding the statement that created the error is to work out where those two lines have to be moved to in order for them to actually do anything at all.

The following statement is what produces the syntax error when you add the extra code into the end of the statement.

Code:
{opacity:'show',height:'show'} $("ul.sf-menu ul li").removeClass("current-menu-item");
Possibly what you intended is as follows (which would pass an object with autoArrows and animation properties into superfish:

PHP Code:
$('ul.sf-menu').superfish({autoArrowstrueanimation: {opacity:'show',height:'show'}}); 
//remove current menu class from drop-downs 
$("ul.sf-menu ul li").removeClass("current-menu-item"); 
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/

Last edited by felgall; 05-03-2012 at 11:33 PM..
felgall 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 01:02 PM.


Advertisement
Log in to turn off these ads.