0.1.1 • Published 6 years ago

webfn v0.1.1

Weekly downloads
34
License
-
Repository
github
Last release
6 years ago

Fn.js

Install

> Download the file

Download latest version

> Get it by npm/cnpm

npm install webfn

Usage

> Import as a single file

Create a script tag and insert it in the HTML file,just like:

<script src="fn.js">

> Import as a es6/node module

import it in the javascript file

import 'fn.js'
let ua = require('webfn/lib/ua')

Sample

The default namespace is "fn",you can use the function as this example

var ua = fn.ua()
//return an object whihc contains some user agent info
{
    isPC:false,         
    isMobile:true,      
    platform:'iphone',  //pc | iphone | ipad ..
    browser:'wx',       //browser name
    version:6           //browser version
}

When you use it as a single file,if the "fn" is existed,or you just wanna change another name,you can do like this:

var ___ = fn.conflict()
__.ua()

Reference

  • ua()
    return a ojbect which contains the user agent info,and add some classes to html element

  • response([opts])
    define the response rules for window size,add some classes to the html element by the custom option

  • resetREM([designSize])
    rewrite the REM base size(modify the html font-size) refer to the design size

  • param(key)
    get the value of the specified key in the url

  • randomColor()
    return a random color string by hexadecimal code,just like"#00CCFF"

  • preLoadImage(srcArr,[cb])
    load some images and exec a callback function

  • typeOf(o)
    judge the type of the target,return a string,just like "string"

0.1.1

6 years ago

0.1.0

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.6

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago