Git Product home page Git Product logo

jquery.hash's Introduction

jquery.hash


spm version

jquery.hash 监听、设置、获取hash


Install

$ spm install jquery.hash --save

Usage

It is very easy to use this module.

// require jquery
var $ = require('jquery');

// extend jquery
require('jquery.hash')($);

// use
$.hash();

HashType

HashType !

#!a/1/b/2/c/3

HashType ?

#?a=1&b=2&c=3

Api

Options

$.hash.defaults = {
    // 传入hash值,为空时默认为当前window.location.hash
    hash: '',
    // 默认hashtype
    type: '!'
}

Functions

get

$.hash().get();
$.hash().get("a");
$.hash().get(["a", "b"]);

set

$.hash().set("key", "val");
$.hash().set({
	"key1":"val1",
	"key2": "val2"
});

remove

$.hash().remove("key");
$.hash().remove(["key1", "key2"]);
$.hash().remove();

stringify

$.hash().set("key", "val").remove("a").stringify("!");
$.hash().set("key", "val").remove(["a", "b"]).stringify("?");

location

$.hash().set("key", "val").remove("a").location("!");
$.hash().set("key", "val").remove(["a", "b"]).location("?");

listen

// listen one
$.hash().listen("key", fn);

// listen or
$.hash().listen("key1", "key2", fn);

// listen both
$.hash().listen(["key1", "key2"], fn);

// listen all
$.hash().listen(fn);

get suffix

$.hash().suffix();

set suffix

$.hash().suffix('123');

Demo

http://spmjs.io/docs/jquery.hash/examples/index.html

History

http://spmjs.io/docs/jquery.hash/history.html

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.