Coder Social home page Coder Social logo

peterpme / reactive-overlays Goto Github PK

View Code? Open in Web Editor NEW

This project forked from awatson1978/deprecated-clinical-overlays

0.0 2.0 0.0 119 KB

Meteorite package to add image and tutorial overlays, using reactive spark templates.

CSS 16.39% JavaScript 83.61%

reactive-overlays's Introduction

Meteorite package to add image and tutorial overlays, using reactive spark templates.

So, after trying probably five or six libraries for creating overlays, I said to heck with it, I'm just going to write a native overlay template for Meteor. Dead simple, super easy to use, and works like charm. Enjoy!


Installation

First, install the reactive-overlays package from the command line, like so:

mrt add reactive-overlays

Document Model

Second, add the reactiveOverlaysTemplate to your application, which adds the nececssary overlay templates. In theory, you should be able to add the template just about anywhere in the application, but the recommend location is at the footer of your application container. So, something like so:

<template name="appContainerTemplate">
    <div class="app-content">
        ... my application code ...
    </div>
    {{> reactiveOverlaysTemplate }}
</template>

Controllers

The beauty of using a native spark template for creating an overlay, instead of a third party library, is the only thing you need to do is set the following Session variable, and Bam! You got an overlay!

    Session.set('show_reactive_overlay', true);

However, people usually want more than just an overlay mask. They want to display images and templates on top of that overlay mask. Fair enough. We expose three simple functions to manage the overlay:

showImageOverlay(elementId)
showTutorialOverlay(elementId)
hideOverlay()

So, for instance, if you want to use a thumbnail as a trigger, and display a nice big photograph, you would want to use something like the following:

Template.samplePageTemplate.events({
    'click .thumbnail-image-a': function(){
        showImageOverlay('#fullsizeImageA');
    }
});

Note: the following is untested. The reactive overlays should also work with a block of HTML code for creating tutorial pages. You should be able to do something like this:

Template.samplePageTemplate.events({
    'click .tutorial-icon': function(){
        showImageOverlay('#currentPageTutorial');
    }
});

License

MIT License. Use as you wish, including for commercial purposes.
See license.mit.txt for full details.


Support

Found this package to be useful? Consider tipping the package maintainer for their time!

Support via Gittip

reactive-overlays's People

Contributors

awatson1978 avatar

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.