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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -