-2

Could someone please tell me why firefox doesn't like this section of code?

function TB_position(){
$('TB_window').set('morph', {
    duration: 75
});
$('TB_window').morph({
    width: TB_WIDTH + 'px',
    left: (window.getScrollLeft() + (window.getWidth() - TB_WIDTH) / 2) + 'px',
    top: (window.getScrollTop() + (window.getHeight() - TB_HEIGHT) / 2) + 'px'
});}

Theres got to be something small missing like a bracket or period or something that I'm missing. Thanks!

**I SOLVED MY OWN PROBLEM! one of my scripts was competing with the other. Thanks anyway!

daniella
  • 403
  • 7
  • 17
  • 5
    What does your firefox say? I am sure it will give you more information to figure out where it is failing. May be you are missing the closing `);` for `.morph({`.. – Selvakumar Arumugam Sep 26 '12 at 17:55
  • Also, what are `TB_WIDTH`, `TB_HEIGHT`, and what's the HTML for `TB_window`? (If the error isn't obvious, it'll help...) – Izkata Sep 26 '12 at 17:57
  • @Izkata That's the problem. This is my first experience with mootools and I'm not sure (its the mootools smoothbox). Its definitely not the closing tag for morph. I forgot to copy and paste that but I definitely have it. I see TB_WIDTH & TB_HEIGHT defined 3 times in my document. TB_WIDTH = 0;TB_HEIGHT = 0; AND TB_WIDTH = imageWidth + 30;TB_HEIGHT = imageHeight + 60; AND TB_WIDTH = (params['width'] * 1) + 30;TB_HEIGHT = (params['height'] * 1) + 40; – daniella Sep 26 '12 at 19:24

4 Answers4

4

Looks like you're missing closing );} ... but, without more code its hard to tell whats going on here.

  • +1 for the disclaimer on _without more code its hard to tell whats going on here_ – Selvakumar Arumugam Sep 26 '12 at 17:59
  • Oh yeah, I forgot to include that in the copy and paste, );} is definitely there. – daniella Sep 26 '12 at 18:13
  • @user1634292 Please edit and fix the question, then, and include some more information (such as, what error is Firebug giving you?), or you'll just keep getting answers pointing out the obvious syntax error – Izkata Sep 26 '12 at 19:32
1
function TB_position(){
$('TB_window').set('morph', {
    duration: 75
});
$('TB_window').morph({
    width: TB_WIDTH + 'px',
    left: (window.getScrollLeft() + (window.getWidth() - TB_WIDTH) / 2) + 'px',
    top: (window.getScrollTop() + (window.getHeight() - TB_HEIGHT) / 2) + 'px'
} //missing paranthesis here ");"
Sahil Kapoor
  • 604
  • 4
  • 9
1

You are missing the closing parenthesis on the morph() call:

$('TB_window').morph({
  ...
}

Should be:

$('TB_window').morph({
  ...
});
matt b
  • 138,234
  • 66
  • 282
  • 345
0
function TB_position(){
$('TB_window').set('morph', {
    duration: 75
});
$('TB_window').morph({
    width: TB_WIDTH + 'px',
    left: (window.getScrollLeft() + (window.getWidth() - TB_WIDTH) / 2) + 'px',
    top: (window.getScrollTop() + (window.getHeight() - TB_HEIGHT) / 2) + 'px'
}); // missing );
} // missing end to function TB_position
Fresheyeball
  • 29,567
  • 20
  • 102
  • 164