jQuery CssDynamic

A dinamic system to customize style css. It append the rules in the end of body

이 스크립트는 직접 설치해서 쓰는 게 아닙니다. 다른 스크립트가 메타 명령 // @require https://update.greatest.deepsurf.us/scripts/26587/169714/jQuery%20CssDynamic.js(으)로 포함하여 쓰는 라이브러리입니다.

질문, 리뷰하거나, 이 스크립트를 신고하세요.
개발자
Mattealex
버전
1.1.1
생성
2017-01-16
갱신
2017-01-16
크기
1.88KB
라이선스
https://creativecommons.org/licenses/by-sa/4.0/

Usage

Base

With CssDynamic you can add properties like standard css method of jQuery

Syntax:

//jQuery standard
$(element).css(property,value)
//jQuery dynamic
$(element).cssDynamic(property,value)

You can also pass an object like new standard of jQuery 3

Syntax:

//jQuery standard
$(element).css({
   property1:value1,
   property1:value1
})
//jQuery dynamic
$(element).cssDynamic({
   property1:value1,
   property1:value1
})

The below parameter represents the actions that may perform (default is add). The actions can be:

  • add
  • new
  • remove
  • rename
  • renew

Add

You can add a new rule to an existing stylesheet (you can use the follow parameter to select it). If it doesn't exist it create the stylesheet

Exemple:

$('.myClass').cssDynamic('color','#DDD','add', 'idStylesheet')

//another use

$('.myClass').cssDynamic({
   'color':'#DDD',
   'font-weight':'bold'
},'add', 'idStylesheet')

//or

$('.myClass').cssDynamic('color','#DDD')
/* `add` like action and `cssDynamic` like id of stylesheet are default parameters */

New

With this action you can create new stylesheet and it will be placed in the end of body

Exemple:

$('.myClass').cssDynamic('color','#DDD','new', 'newIdStylesheet')
/* `cssDynamic` is default id parameter */

Remove

It's easy to remove "cssDynamic" with this syntax:

$().cssDynamic('remove', 'idStylesheetToRemove')
/* `cssDynamic` is default id parameter */

Rename

You can also rename a stylesheet id with another one

$().cssDynamic('rename', 'oldIdStylesheet','newIdStylesheet')

Renew

This action deletes an old stylesheet (by id) and it replace the old stylesheet with the newest

Exemple:

$('.myClass').cssDynamic('color','#DDD','renew', 'idStylesheet')