views:

43

answers:

2

I have using colobox which is a jquery modal window to create a login/regiestration process through modal pages called in an iframe. I am hoping to be able to switch the css from a link within the iframe. I am trying to change the height of the modal window when switching between ajax pages within the iframe. If I try something like this it does not work..

$(".link").click(function () {
  $('#a').css('height', '763px!important');
  });

Is this possible or should I go to sleep now?

+4  A: 
$('#a, #b, #c').css('height', '763px!important');

http://api.jquery.com/multiple-selector/

There's also a list of all available selectors on jquery website, checking it out might be useful.

edit
Regarding iframe issue, you can access parent window containing this iframe with parent variable. For example, this will redirect parent browser window to home google page: parent.location.href='http://google.com'.
I never tried this with jquery, but maybe something like $(parent.document).find('#a') will perform search in the parent document too.

https://developer.mozilla.org/en/DOM/window.parent

Nikita Rybak
Thanks, that is a much better way to write this. I am going to edit my question as I realized that this is not the problem, I can not even make this work with just one selector. The real problem is that I am trying to make this happen from within an iframe :-/
zac
Thanks but that is not working for me
zac
@zac I've changed 'parent' to 'parent.document'. Obviously, we don't look for document elements in Window object.
Nikita Rybak
Aha... I just figured out something at the same time, I ended up using 'top.document' Thanks for your help!
zac
@zac Well, _window.top_ is pretty similar to _window.parent_, only it returns topmost parent: https://developer.mozilla.org/en/DOM/window.top
Nikita Rybak
A: 
jQuery('selector1,selector2,seleccto3....').SomeAction(); 
//separate sectors with comma

in your case

jQuery('#a,#b,#c').css('height', '763px!important');
Praveen Prasad