Giter VIP home page Giter VIP logo

gdom's Introduction

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

gdom's People

Contributors

ghostwu avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.