почему невозможно поменять свойства css
Почему не меняются свойства css в данном случае?
var width_= $('li.active').width() $('li.active:after').css('border-right-width', width_/2+'px') $('li.active:after').css('border-left-width',width_/2+'px') ширину списка определяет |
У псевдо-элемента хочешь поменять?
|
Цитата:
<!DOCTYPE html> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=windows-1251' /> <script src='http://code.jquery.com/jquery-latest.js'></script> <!-- <script src="https://code.angularjs.org/1.3.9/angular.min.js"></script> <script src="https://code.angularjs.org/1.3.9/angular-route.js"></script> <link rel='stylesheet type=text/css href=tmp.css' /> <link rel="stylesheet/less" type="text/css" href="style.less"> <script src="http://cdnjs.cloudflare.com/ajax/libs/less.js/2.5.0/less.min.js"></script> --> <style type='text/css'> li.active:after { content: '----'; border-right-width: 5px; } </style> <script type='text/javascript'> $(function(){ /* var width=$('li.active').width() alert(width); $('li.active:after').css('border-right-width', width/2+'px') $('li.active:after').css('border-left-width',width/2+'px') */ }); </script> </head> <body> <ul> <li class='active'>0</li> <li class='active'>1</li> <li class='active'>2</li> <li class='active'>3</li> <li class='active'>4</li> </ul> </body> </html> |
Цитата:
<!DOCTYPE html> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=windows-1251' /> <script src='http://code.jquery.com/jquery-latest.js'></script> <!-- <script src="https://code.angularjs.org/1.3.9/angular.min.js"></script> <script src="https://code.angularjs.org/1.3.9/angular-route.js"></script> <link rel='stylesheet type=text/css href=tmp.css' /> <link rel="stylesheet/less" type="text/css" href="style.less"> <script src="http://cdnjs.cloudflare.com/ajax/libs/less.js/2.5.0/less.min.js"></script> --> <style type='text/css'> </style> <script type='text/javascript'> $(function(){ alert($('li.active:after').length); }); </script> </head> <body> <ul> <li class='active'>0</li> <li class='active'>1</li> <li class='active'>2</li> <li class='active'>3</li> <li class='active'>4</li> </ul> </body> </html> |
Часовой пояс GMT +3, время: 17:03. |