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!!!
$isn't defined anywhere.noConflict()...but they do say they are using jQuery at least...