Coder Social home page Coder Social logo

jquery-focus-element's Introduction

jQuery Focus Element Beta

This is the first version, so I'll leave it automated.

Jquery Plugin to focus on desired elements leaving the remaining with a black background or the color you want.

As still in beta step 4 is extremely important

Installation

1 - download the file and place it where you want

2 - Preference use require JS

3 - create a div in your code with the name focus-effect

4 - in your css add:

 .focus-effect{ 
    position: fixed;
    cursor: pointer;
    background-color: rgba(0,0,0,.4);
    height: 100%;
    width: 100%;
    z-index: 90;
    top: 0;
    opacity: 0;
    left: 0;
    visibility: hidden;
    transition: 0.2s;
}
.focus-effect.active{
    display: block !important;
    opacity: 1;
    visibility: visible;
}

.object.active{
    position: relative;
    z-index: 100;
}

5 - in your JS:

    $(document).on('click', '.focus-effect.ativo', function() {
        $(document).focus('hideBackground');
    });

6 - There is 5 methods:

6.1 - show: it does the click function on the selected object. ex:

  $('.field.search').focus('show', '.block-search');

6.2 - showManual: You have to do the function you want and than you have it inside. ex:

  $('input').on('click' function(){
    $(document).focus('showManual', '.block-search');
  }) 

6.3 - hide: do the click function and remove the background. ex:

  $('.field.search').focus('hide', '.block-search');

6.4 - hideManual: For manual removal of the selected background and object. ex:

  $('input').on('click' function(){
    $(document).focus('hideManual', '.block-search');
  })

6.5 - hideBackground: It removes only the background (as it is still in the beta it is necessary to manually do this function).

jquery-focus-element's People

Contributors

alefemafra avatar

Stargazers

Matheus B. Barni avatar  avatar Ton avatar

Watchers

 avatar

Forkers

matheusbbarnii

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.