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 8532909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:49:30+00:00 2026-06-11T09:49:30+00:00

How come a javascript function like this below… function stars() { var mOpacity =

  • 0

How come a javascript function like this below…

function stars() {
var mOpacity = $('#area').css('opacity');
if (mOpacity = 1) {

$('#title').find('.stars').animate({"marginTop":"-170px",opacity:1}, 3000)
.animate({opacity: 0}, 400)
.animate({"marginTop":"60px",opacity:0},0, stars);
  }
}
stars();

…breaks my browser when I try to do something like this….

$.stars = function() {
var mOpacity = $('#area').css('opacity');
if (mOpacity = 1) {

$('#title').find('.stars').animate({"marginTop":"-170px",opacity:1}, 3000)
.animate({opacity: 0}, 400)
.animate({"marginTop":"60px",opacity:0},0, $.stars());
  }
}
$.stars();

What is the lesson here between the 2 styles of functions?

Thanks

Ok based on everyones feedback to see more code, here is a full gimplse of the code on my .js file…

function mIntro() {

/********PRE-GAME ANIMATION*********/
$('#area').css({'opacity':0}).delay(1000).animate({opacity:1},300);
$('#title').find('.age').css({'opacity':0}).delay(2000).animate({opacity:1}, 3000);

function stars() {
var mOpacity = $('#area').css('opacity');
if (mOpacity = 1) {

$('#title').find('.stars').animate({"marginTop":"-170px",opacity:1}, 3000)
.animate({opacity: 0}, 400)
.animate({"marginTop":"60px",opacity:0},0, stars);
  } 
}
stars();
}

$(function() {
  mIntro();
});

I have jquery connected to this .js page and I just can’t understand why stars has to be in-cased in a traditional javascript function and not flexibile for a jquery namespace function. I bet it has something to do with the animate tag that re-calls stars, but I am not sure…

Thanks or any advice!!!

  • 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-06-11T09:49:31+00:00Added an answer on June 11, 2026 at 9:49 am

    You’re inadvertently calling it in the second snippet:

    .animate(..., $.stars());
    

    You should code it the same way: pass the function, not the result of calling it:

    Function:             stars      $.stars
    Result of calling:    stars()    $.stars()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The below code is taken from http://bonsaiden.github.com/JavaScript-Garden/ function Foo() { this.value = 42; }
I've come across the following piece of JavaScript and would like to know what
JSON stands for JavaScript Object Notation. But how come languages like php, java, c
,This question is likely subjective, but a lot of grid Javascript plugins have come
ok, today I'm making a helper HTML function. It looks like this: function Input($name,$type,$lable,$value=
I have some HTML that looks like this: $(document).ready(function(){ $('#cumulative-returns').graph({ width: 400, height: 180,
Here's my javascript code: <script type=text/javascript> $(document).ready(function() { var currentInput = ''; var currentLabel
given this javascript code: this.underlyingReference = {name: 'joe'}; this.nullMe(this.underlyingReference); alert(this.underlyingReference.name); function nullMe(variable) { variable
I have a MVC3 action method with 3 parameters like this: var url =
I recently came across the Javascript supplant function by crockford. The function goes like

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.