• Stars
    star
    221
  • Rank 179,773 (Top 4 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Float a number of things up on a page (hearts, flowers, emojis, words ...)

Floating.js

Build Status npm version gzipped size

Let a few elements float infinitely up your page

Usage

  • You can install it via npm install --save floating.js, and browserify it in your page
  • You can download the script and embed it in your page

full documentation

/**
 * Float a number of things up on a page (hearts, flowers, ๐Ÿ‘Œ ...)
 * @param {string} [options.content='๐Ÿ‘Œ']
 *   the character or string to float
 * @param {number} [options.number=1]
 *   the number of items
 * @param {number} [options.duration=10]
 *   the amount of seconds it takes to float up (default 10s)
 * @param {number|string} [options.repeat='infinite']
 *   the number of times you want the animation to repeat (default:'infinite')
 * @param {string} [options.direction='normal']
 *   The <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/animation-direction">
 *   animation-direction</a> of the main animation
 * @param {number|array} [options.sizes=2]
 *   The size (in em) of each element. Giving two values in an array will
 *   give a random size between those values.
 */
floating({
  content: "๐Ÿ™‹",
  number: 1,
  duration: 3,
  repeat: 1,
  size: 3
});

Example

All that was needed to make this example (haroen.me/floating.js) work is this:

<script src="https://unpkg.com/floating.js"></script>
<script>
  floating({
    content: "๐Ÿ˜‡",
    number: 3,
    duration: 11
  });
  floating({
    content: "๐Ÿ‘Œ",
    number: 5,
    duration: 8
  });
  floating({
    content: "test",
    number: 3,
    duration: 15
  });
  floating({
    content: "๐Ÿ™‹",
    number: 1,
    duration: 3,
    repeat: 1,
    size: 1
  });
  floating({
    content: '<img src="https://upload.wikimedia.org/wikipedia/commons/8/84/Weather-snow.svg">',
    number: 10,
    direction: 'reverse'
    size: [1,10]
  });
  floating({});
</script>

As another option you could do:

import floating from 'floating.js';

floating({
  content: "๐Ÿ˜‡",
  number: 3,
  duration: 11
});
floating({
  content: "๐Ÿ‘Œ",
  number: 5,
  duration: 8
});
floating({
  content: "test",
  number: 3,
  duration: 15
});
floating({
  content: "๐Ÿ™‹",
  number: 1,
  duration: 3,
  repeat: 1,
  size: 1
});
floating({
  content: '<img src="https://upload.wikimedia.org/wikipedia/commons/8/84/Weather-snow.svg">',
  number: 10,
  direction: 'reverse'
  size: [1,10]
});
floating({});

Support

This makes use of css animations, which aren't supported on every version of IE.

License

Apache 2.0

More Repositories

1

holmes

Fast and easy searching inside a page
JavaScript
1,702
star
2

emojify-service

Convert your boring texts to nice emoji filled text on macOS!
JavaScript
20
star
3

ccna

A summary of CCNA-useable cisco commands by @elsmr and @Haroenv
CSS
18
star
4

brazzerify

a silly "add brazzers logo" site
HTML
17
star
5

no-facebook-emoji

Get rid of those ugly emojis now! [stopped working ๐Ÿ˜ข]
JavaScript
16
star
6

dev-ui

[WIP] Browser UI for npm and yarn (scripts, dependencies โ€ฆ)
JavaScript
15
star
7

read-one-article

A quarantine-ready Wikipedia game, to be played by two people
JavaScript
14
star
8

gulp-boilerplate-static

A simple boilerplate using gulp, jade, scss, browserify
JavaScript
11
star
9

where-am-i

microservice to get the city and country from last foursquare checkin
JavaScript
10
star
10

wedding-website

A website for @abisummers & my wedding
JavaScript
8
star
11

haroenv.github.io

A personal landing page for Haroen Viaene
HTML
7
star
12

dock-spacer

This is a wrapper for the `defaults` commands that changes some things in the OS X Dock
Shell
5
star
13

terribleme.me

a truly terrible meme
HTML
5
star
14

config

Some config files I use often (also some dotfiles)
Shell
4
star
15

is-dev

Check if you're on a development version or the live version of your site
JavaScript
4
star
16

NewBase60

A port of Tantek ร‡elik's NewBase60 in Swift (http://tantek.pbworks.com/NewBase60)
Swift
4
star
17

mars-status

A status dashboard for Mars. #hackthefuture 2016
JavaScript
4
star
18

jekyll-restaurant

Making a restaurant with a changing menu and hours with jekyll [WIP, no current plans of finishing]
CSS
3
star
19

instantsearch-templates-list

List of templates for InstantSearch
JavaScript
3
star
20

nuxt3-vue-instansearch-example

Vue
3
star
21

mac-processor-info

Open ark.intel.com with your processor (for mac's with intel processors)
Shell
3
star
22

modal

A simple modal at the center of a page in js
JavaScript
3
star
23

alti

A rocket altimeter using the device's gyroscope
HTML
2
star
24

kilometers-ios

The Kilometers app [WIP]
Swift
2
star
25

algolia-blog

The blog for during my internship at Algolia.
HTML
2
star
26

movies

A place to find a movie in your IMDb watchlist
JavaScript
2
star
27

emojibeth

converter from the latin alphabet to lookalike emojis (and more)
HTML
2
star
28

marriage-gift-oui

A mariage gift for a friend
JavaScript
2
star
29

ci-prettier-test

Testing Github Actions fixing prettier
JavaScript
2
star
30

blog

My blog
HTML
2
star
31

dedent.macro

Babel-macro for dedenting template strings
JavaScript
2
star
32

bus

a tracker for the location of a bus
HTML
2
star
33

ris-ssr-mega-demo

Demo of React InstantSearch with React Router / Lazy loading
JavaScript
2
star
34

instantsearch-negative-refinement-list

Gives a list of items to exclude from the current search
TypeScript
2
star
35

notes-eoict

Various notes during the study electronics-ict at Odisee (Ghent) 2014-... (Mostly Dutch) [deprecated in favour of https://ikdoeict-notes.github.io]
PHP
2
star
36

gipod-to-geojson

GIPOD is a service of the Flemish government giving open data of traffic works. This fullfills its claim of being GeoJSON
JavaScript
1
star
37

react-instantsearch-persisting

InfiniteHits, where items do not get lost on navigation
JavaScript
1
star
38

lel.news

The repository for lel news
HTML
1
star
39

notice

A simple notice banner at the top of a page in js
JavaScript
1
star
40

angular-instantsearch-test

This is just a demo repository on how to use InstantSearch (beta) with Angular
TypeScript
1
star
41

algolia-widget-error-sample

TypeScript
1
star
42

thesis

Reimagining InstantSearch.js as a framework-agnostic library, a bachelor thesis
TeX
1
star
43

instantsearch-demo-debounce

demo for comparing instant vs. debounced vs. on enter search
CSS
1
star
44

spectrogram

JavaScript
1
star
45

alter-housing

second version of Project 1 for WebTech 1 at Odisee Ghent
HTML
1
star
46

nuxt-range-example

example for a user
JavaScript
1
star
47

algolia-technical-test

Algolia search with Vue
Vue
1
star
48

simple-jekyll

A base template for jekyll
HTML
1
star
49

tachyons-algolia

CSS toolkit based on tachyons.css, for Algolia branded projects
JavaScript
1
star
50

silent-acres-fest

Project 1 for WebTech 1 at Odisee (Ghent)
HTML
1
star
51

visit-gent

A very simple demo that uses Algolia and open data by Ghent to show touristic features [wip]
HTML
1
star
52

angular-instantsearch-angular-13

little demo showing angular 13 works in angular instantsearch
TypeScript
1
star
53

instantsearch-tagsbox-react

Replaced by InstantSearch labs:
JavaScript
1
star
54

jsdoc-aas

A microservice to transform jsdoc annotated js to markdown
JavaScript
1
star
55

firebase-chat-demo

A demo chat app with Firebase
JavaScript
1
star
56

ci-test-repo

1
star
57

cv

The place where my resumรฉ lives. Written in HTML, exported to pdf
HTML
1
star
58

subtree-test

A test how to use travis to do a subtree push to github pages
HTML
1
star
59

netlify-lambda-test

demo of open search for algolia (with netlify functions)
JavaScript
1
star
60

presentations

Some presentations I've given
JavaScript
1
star
61

nuxt-prefetch-test

test for using serverPrefetch with a nested lib
JavaScript
1
star
62

Toledo

A learning platform made as exercise in Laravel
PHP
1
star
63

trip

Blog about my trip through Belgium
HTML
1
star