
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Simple "zooming lightbox" that doesn't suck.
This is a fairly simple piece of JS code, but also something I've re-written a number of times over the last few years. So here's the "canonical version".
Include the JavaScript code. For Ruby on Rails, you can use the gem (see below).
All you need to do after that is tell it which images to zoom:
$('img').picture_zoomer()
The larger version is loaded either from the data-large
or src
attribute:
<img src="smaller_version.jpg" data-large="larger-version.jpg">
<img src="large_version.jpg" style="width: 100px">
or if you also want your image to do something without JS:
<a href="larger-version.jpg">
<img src="smaller_version.jpg" data-large="larger-version.jpg">
</a>
There's one (optional) argument: the animation speed. The default is 400ms.
// Very fast!
$('img').picture_zoomer(100)
// Just show a large version (don't animate)
$('img').picture_zoomer(0)
That's all there's to it :-)
This is packaged as a Ruby gem ready to use in a Rails app.
Add to your Gemfile
gem 'picture_zoomer'
Add to your application.js
:
// =require picture_zoomer
FAQs
Unknown package
We found that picture_zoomer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.