Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  • Thread Tools
  • Rate This Thread
  1. #1
    New to the CF scene
    Join Date
    Mar 2016
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JQuery syntax error

    I'm trying to use JQuery to do a very simple parallax effect and the console keeps telling me: Uncaught SyntaxError: Unexpected token )

    I've tried to figure out what it means and I just don't see where an extra ) is. Here is the code:


    $(window).scroll(function(){

    var wScroll = $(this).scrollTop();

    $('.title').css({
    'transform' : 'translate(0px, '+ wScroll /2 +'%')'
    });

    });

  2. #2
    Senior Coder Dormilich's Avatar
    Join Date
    Jan 2010
    Location
    Behind the Wall
    Posts
    4,595
    Thanks
    14
    Thanked 480 Times in 475 Posts
    let’s have a look at the offender with code highlighting:
    PHP Code:
    'transform' 'translate(0px, 'wScroll /+'%')
    the colouring should point out the issue JS is complaining about.
    The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.
    André Behrens, NY Times Software Developer


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •