1.12.2 • Published 4 years ago

mk-guide v1.12.2

Weekly downloads
25
License
MIT
Repository
-
Last release
4 years ago
  • A light JavaScript library to guide the user to focus the important part, including fix element.
  • There is Demo with default value

Install

npm install mk-guide
or npm i mk-guide
or yarn add mk-guide

Usage

Import

Import the library and the CSS file

import MkGuide from 'mk-guide'
import 'mk-guide/style.css'

Or for css file

//index.html
<link type="text/css" rel="stylesheet" href="node_modules/mk-guide/style.css">

Creat a variable of guide

Input a new variable mask

// New a maskclass with default value
let mask = new MkGuide()  

Or you could customize it with color:

// Customize it
let mask = new MkGuide({ 
    buttonColor: "gold", // optional   
    skipButtonColor: "firebrick", // optional
    mouseHover: "true", // optional  default:false
    mode: "dark", // default: light
    isFocus: false, // default: true
    isKeyboard: true
})  

Initialize the route and get started

Set the route of guide, and call the mask.start().

// example with 3 step, and it will focus the element of step2
mask.guides = [
    {   
        element: "#step1",                // querySelector
        imgURL: 'https://xxxx/xxx.com',
        header: 'Welcome',
        description: "this is step 1"    // the words of tip
    },
    {   
        element: ".step2",
        description: "Tap in here, and focus it (shouldFocus: true)"
    },
    {
        element: "box3",
        description: "You can control it with'→ ← ESC'"
    },
]

mask.start() // start the mask guide

Or you can use intro.

// Must use intro for the first guide item
mask.guides = [
    {   
        intro: true, // ONLY can be used for the first item! And no element   
        imgURL: 'https://xxxx/xxx.com',
        header: 'Welcome',
        description: "this is step 1" 
        // And do not use 'element' and 'shouldFocus' for intro item
    },
    {   
        element: ".step2",
        description: "Tap in here, and focus it (shouldFocus: true)"
    },
    {
        element: "box3",
        description: "You can control it with'→ ← ESC'"
    },
]

update history

v1.12

Added: IsKeyboard is supported, which can be used to control keyboard.

v1.11

Added: Implemented the function of highlighting the fixed element and refreshing when scrolling.

v1.10

Debug: Fixed the bug of display about the bottom item

v1.9

Added: Dark mode and light mode

Debug: Clear the display bug

v1.8

Added: header, picture, intro, and resize refresh

v1.7

Optimized code structure

v1.4

Debug: Clear the display bug

v1.3

Debug: Clear the keypress && Beyond the margin

v1.1.0

Added customized color API and shouldFocus API

v1.0.2

Added the arrow into the button

v1.0.1

Changed the color of tip

1.12.2

4 years ago

1.12.1

4 years ago

1.12.0

4 years ago

1.11.2

4 years ago

1.11.1

4 years ago

1.11.0

4 years ago

1.10.6

4 years ago

1.10.5

4 years ago

1.10.4

4 years ago

1.10.3

4 years ago

1.10.2

4 years ago

1.10.1

4 years ago

1.10.0

4 years ago

1.9.10

4 years ago

1.9.9

4 years ago

1.9.8

4 years ago

1.9.7

4 years ago

1.9.6

4 years ago

1.9.5

4 years ago

1.9.4

4 years ago

1.9.3

4 years ago

1.9.2

4 years ago

1.2.0

4 years ago

1.9.1

4 years ago

1.9.0

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.21

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago