Jump to content
Search Community

need help with error

schugabug test
Moderator Tag

Go to solution Solved by schugabug,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Can anyone tell me what is wrong with this?  I've searched and searched and cant find it.  I keep getting an error 

Uncaught SyntaxError: Unexpected token var

 at main.js:5
    at main.js:17

 

(function($){
//variables
var $projects = $('.projects'),  //projects container targets every element on the page
 $project = $('.project'), //individual projects
$projectImageBefore =  CSSRulePlugin.getRule(".project-image:before"), //circle behind the image
$projectImageAfter = CSSRulePlugin.getRule(".project-image:after"),  //other circle
tlProjects, tlProject;  
 
 
//cheatsheet basic sytax
tlProject = new TimelineMax({repeat: -1, repeatDelay: 2}); //repeat infinitly/repeatDelay 2 seconds
// target every item on the page now
var projectClasses =$project.attr('class').split(''),
projectClass = projectClasses[1];
 
console.log(projectClass);
})(jQuery);

 

Link to comment
Share on other sites

now it says 

Uncaught SyntaxError: Unexpected number  its pointing to the 2nd to last line as the problem and also a parenthesis is in red on the last line.  I have counted the parenthesis numerous times and cant find the issue..

Anybody see it?

 

(function($){
//variables
var $projects = $('.projects'),  //projects container targets every element on the page
 $project = $('.project'), //individual projects
$projectImageBefore =  CSSRulePlugin.getRule(".project-image:before"), //circle behind the image
$projectImageAfter = CSSRulePlugin.getRule(".project-image:after"),  //other circle
tlProjects, tlProject;  //master timeline &
 
 
//cheatsheet basic sytax
tlProject = new TimelineMax({repeat: -1, repeatDelay: 2}); //repeat infinitly/repeatDelay 2 seconds
// target every item on the page now
 
var projectClasses = $project.attr('class').split(''),
projectClass = projectClasses[1];
 
console.log(projectClass);
 
//finds all instnatces of all pixel inside of project
$pixel =$project.find('.pixel'),
$pixels =$project.find('.project-pixels'),
$projectTitle =$project.find('.project-title'),
$projectSubtitle =$project.find('.project-subtitle'),
$projectImage =$project.find('.project-image');
 
//create a project timeline
tlProject
.set([$projectTitle, $projectSubtitle, $pixel], {autoAlpha: 0}), 
-->{fromTo($projectImage,0.4, {autoAlpha: 0, xPercent:'-200'}, {autoAlpha: 1, xPercent:'-10', ease: Power4.easeInOut});
 
 
})(jQuery)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...