Skip to content
forked from ghostwu/gdom

a javascript framework for operating dom and string

Notifications You must be signed in to change notification settings

zhang-cuishan/gdom

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

gdom 使用方法

a javascript framework for operating dom and string
会用jquey就会用gdom
gdom选择器有两种写法: G( 选择器 ) 和 $( 选择器 )
gdom的加载: G( function(){} ) $( function() {} );

选择器用法

gdom完全支持CSS3选择器,下面列举部分用法

  • 基本选择器( id, class, 元素 )
$("#box").css( "border", "1px solid #09f" );
$(".box").css( "border", "1px solid #09f" );
G("div").css( "border", "1px solid #09f" );
  • 后代,子代选择器
G("body p").css( "border", "2px solid #09f" );
G("body > p").css( "border", "2px solid #09f" );
  • 属性选择器
G( "[id]" ).css( "border", "1px solid #09f" );
G( "[id][class]" ).css( "border", "1px solid #09f" );
G( "[data-target]" ).css( "border", "1px solid #09f" );
G( "[class*=desc]" ).css( "border", "1px solid #09f" );
G( "[class^=desc]" ).css( "border", "1px solid #09f" );
G( "[class$=desc]" ).css( "border", "1px solid #09f" );
  • 过滤选择器
G( "div:nth-child(1)").css( "border", "1px solid #09f" );
G( "div:nth-of-type(1)").css( "border", "1px solid #09f" );
G( "div p:nth-of-type(1)" ).css( "border", "1px solid #09f" );

V1.0.0目前支持的功能有

事件绑定,选择器,DOM操作,动画,工具方法,插件扩展

事件相关方法

  • delegate
  • on
  • hover

选择器函数

  • lt
  • gt
  • eq

dom与其他操作

  • size
  • before
  • after
  • append
  • prepend
  • addClass
  • removeClass
  • hasClass
  • toggleClass
  • css
  • attr
  • each
  • val
  • html
  • empty
  • find
  • parent
  • children
  • parents
  • siblings
  • next
  • prev
  • get
  • getDom
  • index

动画方法

  • animate
  • show
  • hide
  • toggle

工具方法

  • isNum
  • trimLeft
  • trimRight
  • trim
  • parseHtmlTag
  • isArray
  • toArray
  • flatten

插件扩展

  • extend

About

a javascript framework for operating dom and string

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%