Add focal point alignment of images to your Alpine 3.x components with a custom directive.

Overview

Alpine Focal

Add focal point alignment of images to your Alpine 3.x components with a custom directive.

GitHub Build size Brotli

This package only supports Alpine v3.x.

About

This plugin adds a new x-focal directive to Alpine that allows to easliy align your images to keep focus on the selected part of the image.

Installation

CDN

Include the following <script> tag in the <head> of your document, just before Alpine.

<script
    src="https://cdn.jsdelivr.net/npm/@lefrancois/alpine-focal@1/dist/cdn.min.js"
    defer
></script>

NPM

npm install @lefrancois/alpine-focal

Add the x-focal directive to your project by registering the plugin with Alpine.

import Alpine from "alpinejs";
import Focal from "@lefrancois/alpine-focal";

Alpine.plugin(Focal);

window.Alpine = Alpine;
window.Alpine.start();

Usage

Attach the x-focal directive on an image element and enter the point (unsing px or % informations) to keep in focus while containing the image.

<div x-data>
    <img 
        src="..." 
        width="400px" 
        height="600px" 
        x-focal="10% 80%"
        >
    </img>
</div>

Optinally you can use set the third parameter to true (x-focal="100px 100px true") to get a preview image where you can set the focal point with an easy click on the image. Note: Just copy and paste the value to the x-focal attribute of the image element in production. ;) This is just a helper for your development.

License

Copyright (c) 2021 Michael Lefrancois

Licensed under the MIT license, see LICENSE.md for details.

You might also like...

Straightforward interactive HTTP requests from within your Alpine.JS markup

Alpine Fetch Straightforward interactive HTTP requests from within your Alpine.JS markup. View the live demo here What does this do? Alpine.JS is a ru

Dec 21, 2022

Ready to manipulate partitions file? Create a custom partition, apply custom security system, hide the partition and share your hidden data on the www

Ready to manipulate partitions file? Create a custom partition, apply custom security system, hide the partition and share your hidden data on the www

Paranoia 💊 Ready to manipulate partitions file? Create a custom partition, apply custom security system, hide the partition and share your hidden dat

Dec 29, 2022

Simple jQuery plugin that will allow users to zoom in your images, perfect for product images and galleries.

Simple jQuery plugin that will allow users to zoom in your images, perfect for product images and galleries.

Image Zoom (jQuery) Plugin Simple jQuery plugin that will allow users to zoom in your images, perfect for product images and galleries that is less th

Aug 3, 2022

A free and open-source point-of-sale (POS) system for retail and wholesale businesses with support for multiple branches, stockkeeping locations, POS profiles and price lists.

Note: This is a beta version of the software. You are advised to proceed with caution! Overview A free and open-source point-of-sale (POS) system for

Jan 27, 2022

A string of four operations of the library, can solve the js digital calculation accuracy of scientific notation and formatting problems, support for thousands of decimal point formatting output operations

A string of four operations of the library, can solve the js digital calculation accuracy of scientific notation and formatting problems, support for thousands of decimal point formatting output operations

Apr 6, 2022

Screeps Typescript Starter is a starting point for a Screeps AI written in Typescript.

Screeps Typescript Starter Screeps Typescript Starter is a starting point for a Screeps AI written in Typescript. It provides everything you need to s

Jan 27, 2022

We are creating a Library that would ensure developers do not reinvent the wheel anymore as far as Authentication is concerned. Developers can easily register and download authentication codes that suits their need at any point.

We are creating a Library that would ensure developers do not reinvent the wheel anymore as far as Authentication is concerned. Developers can easily register and download authentication codes that suits their need at any point.

#AuthWiki Resource Product Documentation Figma Database Schema First Presentation Live Link API Documentation Individual Contributions User Activity U

Dec 2, 2022

Starting point for total web3.0 beginners.

Web3.0 for total beginners Things to begin with First read this Medium article about web3.0 How does Ethereum work, anyway? Then take a look to this v

Aug 30, 2022

Swaps active audio input device in OBS upon twitch chat channel point redemption.

Swaps active audio input device in OBS upon twitch chat channel point redemption.

OBS-Mic-Swapper Shortcuts Set up Program Description Example of Functionality FAQ Contact Info Set up Create an account on Twitch for your bot Make su

Nov 8, 2022
Releases(1.0)
Owner
Michael Lefrancois
Software developer, Laravel addicted and hyped by LiveWire and AlpineJS
Michael Lefrancois
A lightweight jQuery custom scrollbar plugin, that triggers event when reached the defined point.

Scrollbox A lightweight jQuery custom scrollbar plugin, that triggers event when reached the defined point. Demo Page Table of contents Browser compat

null 15 Jul 22, 2022
Animate your Alpine components.

Animate your Alpine components ?? This package provides you with a simple helper to animate your ALpine.js components. Installation The recommended wa

Ralph J. Smit 18 Nov 16, 2022
Adds a handy $parent magic property to your Alpine components.

✨ Help support the maintenance of this package by sponsoring me. Alpine $parent Access parent components using a handy $parent magic variable. This pa

Ryan Chandler 10 Aug 29, 2022
Kuldeep 2 Jun 21, 2022
Custom Gutenburg blocks to add custom functionalities to your WordPress site. Brought to you by Arif Khan with <3

Gutpress(WordPress Gutenburg Block Plugin) Custom Gutenburg blocks to add custom functionalities to your WordPress site. Brought to you by Arif Khan w

Arif Khan 4 Nov 23, 2022
Little Alpine.js plugin to add a typewriter effect to any HTML element.

⌨️ Alpine Typewriter ⌨️ An Alpine.js plugin to add a typewriter effect to any HTML element. ?? Installation CDN Include the following <script> tag in

Marc Reichel 58 Dec 28, 2022
A basic Svelte tooltip directive.

SVooltip A basic Svelte tooltip directive. Powered by Floating UI. Usage <script> import { tooltip } from 'svooltip'; import 'svooltip/svooltip.css'

Ian 28 Nov 26, 2022
Easiest 1-click way to install and use Stable Diffusion on your own computer. Provides a browser UI for generating images from text prompts and images. Just enter your text prompt, and see the generated image.

Stable Diffusion UI Easiest way to install and use Stable Diffusion on your own computer. No dependencies or technical knowledge required. 1-click ins

null 3.5k Dec 30, 2022
This repository contains an Advanced Zoom Apps Sample. It should serve as a starting point for you to build and test your own Zoom App in development.

Advanced Zoom Apps Sample Advanced Sample covers most complex scenarios that you might be needed in apps. App has reference implementation for: Authen

Zoom 11 Dec 17, 2022