npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

jquery.hookto

v1.0.0

Published

Move an HTML element on breakpoint screen size with dynamic back-in-place.

Downloads

15

Readme

jQuery.HookTo

Hook To - jQuery plugin

Move an HTML element on breakpoint screen size with dynamic back-in-place.

Install

First, you have to add jquery before with plugin on your page. <script src="jquery.min.js"></script>

After, you can call the plugin. Download this repository and call the js file. <script src="jquery.hookto.js"></script>

How to

To move and element on breakpoint screen size :

  • Add data-hook-to="" attribute to your element.
  • Create HTML element called 'hook'. This hook is the destination element on breakpoint screen size.

Example :

<div class="my-element-to-move-on-breakpoint-screen-size" data-hook-to="#where-my-element-will-be-hooked"></div>
<div class="toto">
    <meta id="where-my-element-will-be-hooked"/>
</div>

In this case, my HTML element class="my-element-to-move-on-breakpoint-screen-size" will be insert just after the HTML element <meta id="where-my-element-will-be-hooked">.

See result when screen size pass through the breakpoint.

<div class="toto">
    <meta id="where-my-element-will-be-hooked"/>
    <div class="my-element-to-move-on-breakpoint-screen-size" data-hook-to="#where-my-element-will-be-hooked"></div>
</div>

My element had been moved ! It will return at his original place when the screen size pass through the breakpoint again.

Settings

HTML attributes method

<div 
  data-hook-to-mobile-first="true"
  data-hook-to="#hook-destination" 
  data-hook-to-position="after" 
  data-hook-to-return="768"
  data-hook-to-origin-prefix="hookto-orig"></div>

jQuery method

You can overwrite default values with javascript :

$('.my-element').hookTo(destinationHook, options);
var options = {
  'hookOriginPrefix': 'hookto-orig',
  'position': 'after',
  'returnAt': '768',
  'mobileFirst': true
}

Callback methods

In jQuery, you can add some actions using this callbacks methods.

$('.my-element').hookTo(destinationHook, {
   'onInit': function () {},
   'onHook': function () {},
   'onUnhook': function () {}
});

All attributes

Propriety | Type | Default | Description --------- | ---- | ------- | -----------
data-hook-to-mobile-first | Boolean | true | The element will be move if screen size is > of the breakpoint. ( false, < of the breakpoint ) data-hook-to | HTML element | - | An HTML element. Put # if is an ID, . if is a class. data-hook-to-position | String | after | Put the element just after. ( you can use "before", or "inside" instead) data-hook-to-return | Number | 768 | Breakpoint. Move the element only after with window size data-hook-to-origin-prefix | String | hookto-orig | Breakpoint. Move the element only after with window size.