Giter Site home page Giter Site logo

ramonhenrique / framework7-plugin-welcomescreen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from valnub/framework7-plugin-welcomescreen

0.0 2.0 0.0 1.66 MB

A plugin for Framework7 that displays a swipeable welcome screen to guide the user through a tutorial

CSS 14.08% JavaScript 85.92%

framework7-plugin-welcomescreen's Introduction

Framework7 Plugin Welcomescreen

This plugin will show a tutorial screen when starting Framework7 apps and websites.

(Note: There is also a generic version that does not rely on Framework7 available)

Screenshot

Welcome screen

Live demo

http://www.timo-ernst.net/misc/f7-plugin-welcomescreen

Install

1. Add dependency

npm install f7-welcomescreen

Then import it in your javascript file:

import welcomescreen from 'f7-welcomescreen';

2. Define slides

var welcomescreen_slides = [
  {
    id: 'slide0',
    title: 'Slide 0', // optional
    picture: '<div class="tutorialicon">♥</div>',
    text: 'Welcome to this tutorial. In the next steps we will guide you through a manual that will teach you how to use this app.'
  },
  {
    id: 'slide1',
    title: 'Slide 1', // optional
    picture: '<div class="tutorialicon">✲</div>',
    text: 'This is slide 2'
  },
  {
    id: 'slide2',
    title: 'Slide 2', // optional
    picture: '<div class="tutorialicon">♫</div>',
    text: 'This is slide 3'
  },
  {
    id: 'slide3',
    //title: 'NO TITLE', 
    picture: '<div class="tutorialicon">☆</div>',
    text: 'Thanks for reading! Enjoy this app.<br><br><a id="tutorial-close-btn" href="#">End Tutorial</a>'
  }
];

Used parameters are:

  • id Set an id for this slide
  • picture Set free html here
  • text You can set html here but I recommend using just plain text

3. Initialize & options

Framework7.use(welcomescreen);

// Define options for welcomescreen plugin
var options = {
  'bgcolor': '#0da6ec',
  'fontcolor': '#fff'
}

var app = new Framework7({
  root: '#app', // or what ever your root is
  name: 'welcomescreen-demo', // choose a name
  welcomescreen: { // Setup welcomescreen plugin
    slides: welcomescreen_slides,
    options: options,
  },
});

Available options (if not set, default will be used)

  • bgcolor Set background color
  • fontcolor Set font color
  • closeButton (Default: true) Enabled/disable close button
  • closeButtonText (Default: 'Skip') Close button text
  • cssClass (Default: '') Additional class on container
  • pagination (Default: true) Swiper pagination
  • navigation (Default: false) Swiper navigation
  • loop (Default: false) Swiper loop
  • template (Default: String) Pass in a custom Dom7 template to render Welcomescreen
  • open (Default: true) Open welcome screen on init
  • onOpened (Default: none) Callback function when welcomescreen is opened
  • onClosed (Default: none) Callback function when welcomescreen is closed
  • parallax (Default: true), Enable parallax
  • parallaxBackgroundImage (Default: 'http://lorempixel.com/900/600/nightlife/2/') Parallax default background image
  • parallaxBackground (Default percentage: '-23%') Parallax default background speed effect
  • parallaxSlideElements (Default number per element: {title: -100, subtitle: -200, text: -300}) Set speed of each element in parallax mode

Note:

  • number - value in px (as for title, subtitle in example above) to move element depending on progress. In this case such element will be moved on ± this value in px depending on slide position (next or previous)
  • percentage - (as for "parallax-bg") to move element depending on progress and on its size. In this case such element will be moved on ± this percentage of its size (width in horizontal direction, and height in vertical direction) depending on slide position (next or previous). So if element has 400px width and you specified data-swiper-parallax="50%" then it will be moved on ± 200px

API

The following methods are available on a welcomescreen instance

app.welcomescreen.open();         // Open the screen
app.welcomescreen.close();        // Closes it
app.welcomescreen.next();         // Go to next slide
app.welcomescreen.previous();     // Go to previous slide
app.welcomescreen.slideTo(i);     // Go to slide with index i

Example

See demo directory. Open dist/index.html there.

Framework 7 compatibility

F7 version Compatible? Note
V1 (1.x) No See old V1 version
V2 (2.x) Yes

Credits

Made with <3 by www.timo-ernst.net

My YouTube channel about Framework7: http://youtube.com/xvalmar

framework7-plugin-welcomescreen's People

Watchers

 avatar  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.