jQuery: How can I set css with own width? -
i'm trying set labels right property can change on mouse over.
the reason i'm doing via jquery because each 1 has different size doesn't allow via css.
this have:
$('#vertical-navigation .label').css('right', $(this).width()); which, of course, doesn't work, because $(this) returning believe window width.
how can set right position element own width, each one?
you can use function parameter this:
$('#vertical-navigation .label').css('right', function(){ return $(this).width() + 'px'; }); now depending html markup, enough:
$('#vertical-navigation .label').css('right', '100%');
Comments
Post a Comment