Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7581149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:07:49+00:00 2026-05-30T18:07:49+00:00

Edit 3/02/12: Found another solution that worked by itself without the need for any

  • 0

Edit 3/02/12: Found another solution that worked by itself without the need for any other functions; see my own answer below.


I just don’t see what’s wrong here and have had no luck with the answers to all the other questions titled “SyntaxError: Expected token ‘}'”

I’m working with a sticky div function that keeps <div class="sticky"> always visible on window scroll.

jQuery 1.7.1 is included by WordPress and loads before the two functions below. All functions load, according to Dev Tools.

A <div class="sticky">with various html</div> is placed just about the </body> tag.

But I get a SyntaxError: Expected token ‘}’ error.

This is in header:

$(document).ready(function(){
    $('.sticky').jsticky({
        marginTop: 0,
    });

This main function is included above it:

(function($){
    $.fn.extend({ 
        //plugin name - jsticky
        jsticky: function(options) {

            //Settings list and the default values
            var defaults = {
                marginTop: 0
            };

            var options = $.extend(defaults, options);

            return this.each(function() {
                var o = options;

                //Assign current element to variable, in this case is UL element
                var obj = $(this);   


    var offset = obj.offset();
    var topOffset = offset.top;
    var marginTop = obj.css("marginTop");
    var marginTopNum = parseInt(marginTop);

    var diff = topOffset - marginTopNum;


    var offset = obj.offset();
                var topOffset = offset.top;
                var leftOffset = offset.left;
                var marginTop = obj.css("marginTop");
                var marginLeft = obj.css("marginLeft");


                $(window).scroll(function() { 
                    var WindowScrollTop = $(window).scrollTop();
                    var scrollTop = WindowScrollTop + o.marginTop;

                    if (scrollTop >= topOffset){

                        obj.css({
                            marginTop: o.marginTop,
                            marginLeft: leftOffset,
                            position: 'fixed'
                        });
                    }

                    if (scrollTop < topOffset){

                        obj.css({
                            marginTop: marginTop,
                            marginLeft: marginLeft,
                            position: 'relative'
                        });
                    }
                });


            });
        }
    });
})(jQuery);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:07:50+00:00Added an answer on May 30, 2026 at 6:07 pm

    Found another solution that worked by itself without the need for any other functions:

    var name = "#sticky";
    var menuYloc = null;
    
    $(document).ready(function(){
    menuYloc = parseInt($(name).css("top").substring(0,$(name).css("top").indexOf("px")))
    $(window).scroll(function () { 
    offset = menuYloc+$(document).scrollTop()+"px";
    $(name).animate({top:offset},{duration:500,queue:false});
    });
    }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT - FOUND A EASY 5-10 LINE SOLUTION!!! See MY OWN ANSWER BELOW!!! YAY!!!!!!!!!
Edit: From another question I provided an answer that has links to a lot
Edit: I have since found and published an efficient and elegant solution that transforms
[edit] Found the solution. Reinstall EVERYTHING - xcode, mono, monodevelop and monotouch. Now it
EDIT: I found out that I can get it to compile if I cast
EDIT 9-3-10: I found this blog entry recently that was very enlightening. http://optimizermagic.blogspot.com/2007/12/outerjoins-in-oracle.html There
I've found that on some occasions I can edit the source while debugging. Are
Edit: This code is fine. I found a logic bug somewhere that doesn't exist
Here is a hum-dinger of a problem that I have not found an answer
I have found a few libraries to edit MP3 tags (UltraID3Lib is great) but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.