cavis / gridheist Goto Github PK
View Code? Open in Web Editor NEWA jQuery plugin to hijack an image gallery, making it great.
License: MIT License
A jQuery plugin to hijack an image gallery, making it great.
License: MIT License
Could the plugin adapt to various devices? My thoughts are
This would be helpful for when you've uploaded images of the same height (in my case 650px) but the size of the device makes it so the image has to be less tall because it can't fit width wise.
Would be awesome to specify either a pixel width or percentage of original that would limit how skinny a thumb could get.
Hey.
Trying to implement this plugin in an Angular project. It loads successfully but even within doc.ready closure it throws the error:
GridHeist.prototype.getDimensions = function($img, callback) {
var h, tmp, w;
if ((w = $img.data('width')) && (h = $img.data('height'))) {
return callback(w, h);
} else {
tmp = new Image();
return $(tmp).load(function() {
$img.data('width', tmp.width);
$img.data('height', tmp.height);
return callback(tmp.width, tmp.height);
}).error(function() {
<------ Throws this error every time ----->
console.error('An error occurred and your image could not be loaded. Please try again.');
return callback(100, 100);
}).attr({
src: $img.attr('src')
});
}
};
Any ideas?
Edit: Angular layout...
<div class="image_grid" ng-show="gallery.images">
<a href ng-repeat="image in gallery.images">
<img src="/{{ image.location_of_original_file + '600x400/' + image.filename }}" >
</a>
</div>
Edit again: JS at the bottom of the page
$(document).ready(function() {
// gridheist the images
var options = {
thumbBorder: 10,
thumbMinHeight: 10,
thumbMinWidth: 100,
thumbMaxHeight: 400,
expander: false
};
$('.image_grid').gridHeist(options);
Edit I swear to God the last time: even if I place data-height and data-width images it doesn't actually appear to be changing the layout, they just have the height and width css properties set now.
<div class="image_grid" ng-show="gallery.images">
<a href ng-repeat="image in gallery.images">
<img src="/{{ image.location_of_original_file + '600x400/' + image.filename }}" data-height="300" data-width="400">
</a>
</div>
When using the jQuery lazyloading GH has a hard time working with the placeholder image. Unless I'm doing it wrong. Here's the code
var options = {
thumbBorder: 10,
thumbMinHeight: 10,
thumbMinWidth: 100,
thumbMaxHeight: {{ Settings::getSetting('thumbnail_height') }},
expander: false
};
$('.gallery').gridHeist(options);
$(".lazy").lazyload({
event: "scrollstop",
threshold: '200',
load : function()
{
$('.gallery').gridHeist('update');
}
});
And the HTML:
<li>
<a href="http://app.nationalmachine.co/users/1/galleries/2/2/ElizabethAndJarett0045.JPG" data-uid="70">
<img class="lazy" data-original="http://app.nationalmachine.co/users/1/galleries/2/2/thumbs/ElizabethAndJarett0045.JPG" src="http://app.nationalmachine.co/images/placeholder.jpg" width="450" height="300">
</a>
</li>
Same idea as min-width.
Would be awesome to be able to define load x number of images in front of active image, load x number behind active image.
Hi Ryan.
Is there a way that I can make sure that all images are vertically centered even if they have different heights?
Thanks!
Matt
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.