Показать сообщение отдельно
  #4 (permalink)  
Старый 15.02.2019, 19:05
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,069

alex-romanov,

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<style type="text/css">

</style>
<script src="https://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$.fn.plugin = function (prop) {
        /*атибуты стиля тега 'th'*/
        var styleAttributesForTh = {
            'border': 'solid 1px green',
            'padding': '5px',
            'width': 'auto',
            'font-size': '20px',
            'font-style': 'italic'

        };


        /* arrTh - массив заголовков*/
        var options = $.extend({
             selectorForCreateElemInto: 'body'
        }, prop);

        options.styleForTh = $.extend({}, styleAttributesForTh, options.styleForTh);

        return this.each(function (index, self) {
        $(self).css(options.styleForTh)
    })
}
</script>
<script type="text/javascript">
$(window).load(function(){
$(".box").plugin({
     styleForTh : {
         border : 'solid 5px red'
     }
});
$(".too").plugin();

});
</script>
  <title></title>
</head>
<body>
<button class="box">is box</button>
<div class="too">is too</div>
</body>
</html>
Ответить с цитированием