Coder Social home page Coder Social logo

wookmark-jquery's Introduction

Join the chat at https://gitter.im/germanysbestkeptsecret/Wookmark-jQuery Read the docs Build Status

Wookmark

This is a plugin for laying out a dynamic grid of elements.

See the documentation page for examples.

The repository also includes many functional examples. All images used in the example are copyrighted by their respective owners and only included for showcasing plugin functionality.

Do you like this project? Buy us a beer

How to make the examples work

First download or clone this repository. Because we use the bower package manager for jQuery and other libraries you currently have to to install bower first. After that you can run bower install and all necessary libraries for the examples will be installed.

We will provide a special download in the future which contains all necessary packages.

Further documentation

We are currently creating a new and better documentation at readthedocs. Its automatically created by the sources in the doc directory.

The documentation can be rendered locally by installing sphinx and sphinx-autobuild and running sphinx-autobuild . _build in the doc directory.

Upgrading to version 2.0

Since version 2.0 of Wookmark, the plugin doesn't depend on jQuery anymore. This allows you to use Wookmark without the overhead of the jQuery library.

Because this meant a big change to the plugin, we also changed a lot in the code and tried to make it easier to use. The way you initialize the plugin is now different and a few options have changend. So if you upgrade you have to adapt your code. See the examples and this readme on how to do this.

Installation

Install with bower

bower install wookmark-jquery

Install with npm

npm install wookmark

jQuery is optional and is used in some of the examples to simplify the code a bit

Required files

Copy wookmark.js or the minified version wookmark.min.js to your javascript folder. There are some styles for tiles-wrap in css/main.css you might want to use.

Usage

The plugin can be intialized in different ways. options are optional.

Default without jQuery

var wookmark = new Wookmark('#myElementContainer'[, options ]);

jQuery call with default settings:

$('#myElementContainer').wookmark(options);

Where myElementContainer is the class or id of the element or elements wrapping your tiles. A Wookmark instance will be created for each element.

Options

{
  align: 'center',
  autoResize: false,
  comparator: null,
  container: $('body'),
  direction: undefined,
  ignoreInactiveItems: true,
  itemWidth: 0,
  fillEmptySpace: false,
  flexibleWidth: 0,
  offset: 2,
  onLayoutChanged: undefined,
  outerOffset: 0,
  possibleFilters: [],
  resizeDelay: 50,
  verticalOffset: undefined
}

See the documentation page for details on available options.

itemWidth and flexibleWidth

These values can be given as numbers which will be interpreted as pixels or you can use percentage strings like '20%'. You can also provide a function which should return either a number or a percentage string. When flexibleWidth is set and itemWidth is not 0 itemWidth used as minimum item width. As example using a flexibleWidth of 40% will result in two columns with 10% space to the sides of the container.

offset, outerOffset and verticalOffset

offset is the horizontal and vertical space between two tiles. outerOffset is the space between the outer tiles and the parent container. verticalOffset is optional and can be set to achieve a vertical offset between two tiles which is different from offset.

fillEmptySpace

This creates placeholders at the bottom of each column to create an even layout. See example-placeholder on how to use it. These placeholders use the css class wookmark-placeholder. You can overwrite it in your own css to fit your needs.

ignoreInactiveItems

When set to false inactive items will still be shown when filtered. This can be used to fade out filtered items. See the example-filter/fade.html example.

comparator

You can use this option to provide a custom comparator function which the plugin will use to sort the tiles. See example-sort or example-stamp on how to use it.

Refresh trigger

Elements which are hidden have cannot be laid out until they are visible. If you use wookmark on a hidden tab layout will not be immediately performed. When the tab is made visible you can manually refresh Wookmark using a trigger on your container.

wookmark.layout(true);

or

document.getElementById('container').dispatchEvent(new Event('refreshWookmark'));

or with jQuery

$('#container').trigger('refreshWookmark');

Resize trigger

A relayout happens then the viewport is resized, you can also trigger this manually via

window.dispatchEvent(new Event('resize'));

or with jQuery

$(window).trigger('resize');

Filter

You can filter all items of the handler when they have filters specified. See example-filter for details how to do this. The call to filter will also return the resulting list of items.

wookmark.filter([filters=[]][,mode='or'][,dryRun=false]);

If you just want to check if there would be a resulting list of items you can call filter with the dryRun option set to true.

Annotated code

See our docco.

Included examples

Some of the examples need the jQuery or imagesLoaded plugins. Be sure to run bower install to have them working.

example

Is the preferred setup. In this scenario the width and height of all images is set in the HTML img attributes. The grid layout can be performed as soon as the document is rendered, BEFORE images are loaded.

example-load-images

In this example, the width and height of the images is not known. Via Paul Irish's imagesLoaded plugin (slightly modified by desandro). The grid layout is performed after all images are loaded and their dimensions can be retrieved. This approach is much slower. The imagesLoaded plugin can also be found on github right here: https://github.com/desandro/imagesloaded

example-amd

This example shows how to load and initialize the plugin when using require.js or a different amd loading method.

example-api

This example shows how to load the tile data from a remote api and layout it.

example-endless-scroll

This example shows how to add new tiles at runtime and refresh the layout.

example-filter

This example shows to use the filter feature of the plugin to show just the tiles the user wants.

example-flexible

This example shows how to use the flexibleWidth option. This option allows your tiles to grow a certain amount, as long as there is room. When using percentage values for the width options you can create a fixed column count layout.

example-lightbox

This example shows you how to include a lightbox.

example-placeholder

This example shows you how to enable placeholders at the bottom of the tile layout to create an even footer.

example-sort

This example shows how the sort feature works. This option allows you to specify a sorting function which will rearrange your tiles. For example you can use it to sort your tiles containing products by price, popularity or name.

FAQ

The tiles overlap after loading.

You should use the 'imagesloaded' plugin. Most the examples in this package include the code how to use it.

The tiles overlap after their height is changed.

Use the 'finished'-callback of your animation/effect to trigger 'refreshWookmark' on the container element supplied to the plugin.

The placeholders at the end of each column have wrong heights or positions.

Set 'position: relative' on your container element and check if there are other elements in the container before your tiles.

My question isn't answered here.

Send us some feedback or create an issue on github.

Mentioned or used by others

Beware: These links lead to sites which are not necessarily related to the authors of the Wookmark plugin so we don't have any control over their content.

Send a message if you want to be included with your site on this list!

Feedback

Please send code specific questions and feedback to Sebastian or contact him on twitter.

If you have other questions and feedback which is for example related to Wookmark send a mail to Christoph or contact him on twitter.

Contributing

Contribute!

wookmark-jquery's People

Contributors

aakashlpin avatar chrillo avatar davebrace avatar daviddavid avatar gabriel-kaam avatar gbks avatar guiwoda avatar jamedjo avatar kkirsche avatar matt-d-rat avatar maybach91 avatar niklasnordlund avatar quangkcao avatar romaric-juniet avatar sandeepshetty avatar sebobo avatar sreekumarvk avatar tclancy avatar teawithfruit avatar toao avatar waffle-iron avatar weberhofer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wookmark-jquery's Issues

Height bug because of hidden images

I discovered a bug where

heights[shortestIndex] = shortest + item.outerHeight() + this.wookmarkOptions.offset;

processes any hidden images as well and ends up adding a constant height (wookmarkOptions.offset) for every processed hidden image. I fixed my local copy by:

if(item.outerHeight() != 0){
heights[shortestIndex] = shortest + item.outerHeight() + this.wookmarkOptions.offset;
}

Maybe you guys can look into this for any future release ...

Randomise order of images

Is it possible / would it be possible to randomise the order of the images; and possibly keep the filter function?

Loading FB comments widgets

I am playing around with your excellent plugin and wonder if you would mind answering a question. I see you have the imageLoad call to deal with images and the height of the item containing the image but I have a slightly different problem that I can’t see a solution to.

I load the Facebook comments widget into each item and after playing with the load order and loading woodwork via $(window).load I cant get woodwork to allow enough space for the widget. Have you come across this before, do you know how I may be able to fix this?

Using jquery wookmark plugin while dynamically changing heights of elements

I am using the wookmark plugin and have gotten it to work as they show on their website. In my use case, when I hover over a particular element, it "expands" vertically. This obviously messes up the absolute positioning of the elements below the expanded element in that column. I am trying to modify/augment the wookmark plugin to handle my use case and was wondering whether anyone had some tips on how I can approach this problem.

Thanks.

Overlapping of images

Hello!

First off, I want to thank you for this GREAT plugin. Definitely a very awesome plugin and saved me a lot of time and effort, etc (Plus it seems much easier to setup than Masonry).

Anyways, I kinda believe I know the "issue" that I'm bringing up and it is something that has to do with one of your the other issues posted here.

Basically, I have a page where users can add content (images, name for image, etc) sorta like Pinterest onto a site, where it will then be organized based on your script.

(Quick backstory: I developed it using Rails 3.2, picture upload is handled via Carrierwave gem)

As the picture could either be uploaded as a portrait or a landscape, I utilized a nifty command from Carrierwave/Minimagick to resize the picture to fit a certain height and width.

As placing these pictures with the order using wookmark is more concerned with the width, I fixed the width and can't fix the height (as the portrait will look longer than landscape, and if I were to fix a height landscape pictures would cause a gap below it).

Now when I view the page with a mix of portrait and landscape pictures, the pictures on the '2nd row' actually overlaps the top row. When I resize the browser though, the pictures are sorted nicely.

I understand this issue is probably due to there being a lack of declared height on the pictures, and hence the plugin can't 'calculate' it yet upon load (even if the pictures are cached). I would like to however ask if you know any good workaround to maybe 'reactivate' the plugin or something when all pictures are loaded? Right now I'm not sure how to work around this issue and it's of course not user-friendly to ask the user to resize his/her browser everytime he load a new page...

Thanks for any potential help!

Put More Button after <ul>...</ul>

Dear all..

I am using Wookmark, but how to put more button for display more item after main container (

    ), I have tried but the button always display on the top before first
  • . I guess it because absolute style.

    I have tried too put a button more in a

  • as li:last as a children container same as other li tag, it works like a charm, but now I want to put the more bottom after
      as container so it's as out of a part of
        . Then when the button click, response items will append on the
          . In this case I don't want using scroll for fetching more items..

          Is there anybody should like your hands?

          thanks....

Sometimes Good and Sometimes Bad

I have the problem with Wookmark....

Why the container display bad when append new item when refresh page, and sometime display correctly... my code is

<script type="text/javascript"> $(document).ready( new function() { wk(); }); function wk() { $(document).ready(new function() { // Prepare layout options. var options = { autoResize: true, // This will auto-update the layout when the browser window is resized. container: $('#product-wmrk-list'), // Optional, used for some extra CSS styling offset: 2, // Optional, the distance between grid items itemWidth: 210 // Optional, the width of a grid item }; if(handler) handler.wookmarkClear(); // Get a reference to your grid items. var handler = $('#product-wmrk-list li'); // Call the layout function. handler.wookmark(options); }); } </script>

I create function because the function will recall using ajax json later...

When I want to append new item about 3 items, the wk() will can again for adjustment of container size, the problem here comes, and sometime container adjustment correctly and sometimes bad....

Any suggestion for the problem, thanks...

Loader per Image

Is there a way to display a loader for each image / containers are loaded but then you see a loader for each image?

Any suggestions?

Cheers
Nik

Problem footer after apply

Hello

my page has a footer, and after I apply, the footer position does not change because position item absolute, how to fixed it?

Doing more Justified distribution.. Like Fab.com

I needed more Fab.com Feeds effect so I modified the code a bit, so the boxes are more justified effect rather than getting more "centered" effect..:

Modify:

//var offset = Math.round((containerWidth - (columns_columnWidth-options.offset))/2);
var offset = Math.round((containerWidth - (columns_columnWidth-options.offset))/(columns-1));

And:
//left: (shortestIndex_columnWidth + offset )+'px'
left: (shortestIndex_columnWidth + (shortestIndex*offset) )+'px'

class等于topright的时候,让他在第一排最右边

  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1

<ul class="box">

<li class="wfc">1</li>

<li class="wfc topright">1</li>

<li class="wfc">1</li>

<li class="wfc">1</li>

<li class="wfc">1</li>

<li class="wfc">1</li>

<li class="wfc">1</li>

<li class="wfc">1</li>

<li class="wfc">1</li>

</ul>

class等于topright的时候,让他在第一排最右边

api

sorry, im new with json. i try example-api with var apiURL = 'http://www.wookmark.com/api/json/popular' - its work fine.
Next, i change this apiURL to my URL this one: websiteaddress/api/1.js
Contained copy http://www.wookmark.com/api/json/popular content. And its not works. Why?

I have static html website. I have php on server. But how i can make file with content for var apiURL. Its possible give for var apiURL static .js-file or not? if its possible. what is example structure must have it?

Wookmark with MVC3

I'm trying to use the wookmark plugin but I'm having trouble getting it working. I'm using MVC3. Are there any issues or extra steps needed?

Bug: Links doesn't work correctly when you FILTER them (esp. if you use FancyBox)

When you want to use filters with <a> links like the code below, you realize that links just broken because ".inactive" images overlap.

...
<li class="berlin art">
    <a href="images/berlin.jpg" rel="portfolio" title="Berlin Art" class="fancybox-thumb">
        <img src="images/t02.jpg" height="109" width="140">
    </a>

    <p>Berlin Art</p>
</li>
...

You can solve this issue as adding just one line code in the CSS file. You should change this code:
#tiles li.inactive {
opacity: 0;
}

with this one:
#tiles li.inactive {
opacity: 0;
z-index: -1;
}

I spent 3-4 hours for this issue :)) I hope this helps someone.

Suggestion Code

Hello GBKS...

This plugin has included in my project, and try and error because some case, than I have a conclusion, that is ....

I think this code/plugin should be added a code like this before apply layout rather than added or using more plugin like jquery.imageloaded.js or another one...

the logic is like...

$('#container li img').load(function(){
///more code for apply layout
});

My reason, it can be handle applying layout dynamically each image loaded completely, so we don't worry about bad layout because other image not complete yet, layout will be updated or applied from the first image loaded complete and then layout will be apply again if second image or next image complete loaded and more....it more dynamic, so for responsive pae it make better.

What do you think...

Thanks...

Saiful Amri

Image overlap

This plugin has worked wonders so far, but there is a small issue that I have on initial load of the site and I'm not sure how to fix it.

Image of the same height overlap each other vertically on initial load. After the screen has been resized to any smaller size, the images adjust and the problem is fixed so it is just when all the images are first shown on the screen.

I am loading images in through an xml file, so I will try to see if the problem persists if I use static images, but I am stumped on this issue. See http://cravery.comeze.com for an example of the issue.

Thanks much!

Wookmark does not work when jQuery.noConflict is being used

A TypeError: $ is undefinedis issued if jQuery's alias $is not available, which is the default scenario if your are trying to use Wookmark in WordPress website, for example.

This can be easily solved wrapping the plugin's code like this:

if (jQuery !== undefined) {
    (function($, undefined) {
        // Wookmark's code goes here
    }(jQuery));
}

Hope this helps. Great jQuery plugin. Thank you.

Unable to make it work (noob)

I have this markup structure:
http://snippi.com/s/y033f55

I try to run this, but with no apparent result:

<script type="text/javascript"> $(document).ready(new function() { // Prepare layout options. var options = { autoResize: true, // This will auto-update the layout when the browser window is resized. container: $('#rssBody'), // Optional, used for some extra CSS styling offset: 2, // Optional, the distance between grid items itemWidth: 220 // Optional, the width of a grid item }; ``` // Get a reference to your grid items. var handler = $('#tiles li.odd'); // Call the layout function. handler.wookmark(options); // Capture clicks on grid items. handler.click(function(){ // Randomize the height of the clicked item. var newHeight = $('img', this).height() + Math.round(Math.random()*300+30); $(this).css('height', newHeight+'px'); // Update the layout. handler.wookmark(); }); }); ``` </script>

Can anyone help me out?

Hiding some items and adding items dynamically

Hey guyz...
thanks for sharing your plugin guyz.. can you please help me out with hiding some items

  • ??? When hide 'em their blank space appears in wookmark dynamic grid layout.. instead that space should be spared for hidden item.. if any item is hidden than other item should come to that place..

    and how can I add items dynamically on runtime??? can you please help me on this???

    Thank you!

  • Setting image height to 100% messes Wookmark

    Every item i have in Wookmark contains images in different aspect ratio. To preserve the aspect radio i set style of each image to: width: 256 (its the width of column as well) and height to 100%. But when i do it items below move to upper upon the items above. It's like wookmark does not handle the situation height is not static.

    Is there a way to fix it on my side or in Wookmark?

    Put More Button after <ul>...</ul>

    Dear all..

    I am using Wookmark, but how to put more button for display more item after main container (

      ), I have tried but the button always display on the top before first
    • . I guess it because absolute style.

      I have tried too put a button more in a

    • as li:last as a children container same as other li tag, it works like a charm, but now I want to put the more bottom after
        as container so it's as out of a part of
          . Then when the button click, response items will append on the
            . In this case I don't want using scroll for fetching more items..

            Is there anybody should like your hands?

            thanks....

    Filter

    Hi,

    Implemented a filter on top of the plugin, so I can hide/show the

  • s with a given class. Only it does not rearange the items. Is there a way to an a hide or show change to auto refresh the list and only show the
  • that are supposed to be shown? see http://www.wuhaa.nl/getinspired.asp for an example...

  • Update layout

    Hi!
    I added comments box to each tile. Problem is, whenever I toggle this box down it appears behind the tile below. Whenever I toggle this up, an empty area appears. I tried various methods of updating the layout, nothing seemed to work.
    "$('[class='tiles'] div').trigger('refreshWookmark');" didn't work as well.
    Thanks!

    Using jquery animate to slide image down and reveal text

    I'm trying to add a jquery amimate call to an image click but It fails to execute. I don't see any errors in the console. I'm trying to click the image and have it slide down revealing text behind the image similar to the hover effect seen here: http://www.incg.nl/blog/2008/hover-block-jquery/example/animate_hover.html. Do you know if this is possible?

    My current call looks like this:

    $('#tiles').imagesLoaded(function() {
      // Prepare layout options.
      var options = {
        autoResize: true, // This will auto-update the layout when the browser window is resized.
        container: $('#main'), // Optional, used for some extra CSS styling
        offset: 10, // Optional, the distance between grid items
        itemWidth: 210 // Optional, the width of a grid item
      };
    
      // Get a reference to your grid items.
     var handler = $('#tiles li');
    
      // Call the layout function.
      handler.wookmark(options);
    
      // Capture clicks on grid items.
     handler.click(function(){
    
    
        var h = $('img', this).height();
        $('img', this).animate({top: h+'px'},{queue:false,duration:500});
    
        // Update the layout.
        //handler.wookmark();
      });
    });
    

    BTW, thanks for a great plugin!

    After filter problem

    Hi,

    I have used filter on my page and the filter works nice, the only problem that I have is that: when I click one of the filter link, the images replaces each other, but the height of body does not update.

    After every filter, I have long white space under the filtered images.

    How should I update the page after filter???

    The uploaded image is captured after filter.

    Thanks in advance.
    filter

    Horizontal offset and Vertical offset

    First of all, I love wookmark. I just started using it on a project and I love how light it is. Is there a way to have a different horizontal offset and vertical offset? Currently, there is only 1 flavor of offset that get's applied to both horizontal and vertical offset. Is this feature available, but just not documented? Could you add this as a feature? Thank you.

    Problem on pageload in chrome

    On my page calling

    // Update the layout.
    handler.wookmark(options);

    Works as expected in Firefox and Internet Explorere, but in chrome the layout is all wrong until I added a settimeout for 5 seconds, and called it again.

    Go here:
    http://poteau.me/news/local-news/

    To see the issue. (That is my test site)

    Does Wookmark support real endless scroll?

    I checked the example with endless-scroll enabled. It seems it is not a real one -- the js simply remove the previous layout and create a new one with the images have been showed. Is there any tweak to load more images when a user scrolls down?

    Thanks!

      if(closeToBottom) {
        // Get the first then items from the grid, clone them, and add them to the bottom of the grid.
        var items = $('#tiles li');
        var firstTen = items.slice(0, 10);
        $('#tiles').append(firstTen.clone());
    
        // Clear our previous layout handler.
        if(handler) handler.wookmarkClear();
    
        // Create a new layout handler.
        handler = $('#tiles li');
        handler.wookmark(options);
      }
    

    rtl support

    Hello,
    I would like to know if it supports rtl (right to left)?
    Thanks

    Strange Behavior - First Item

    Hello there,

    I'm working with a team on getting the wookmark plugin integrated with a new site we're building. We're chopping the code up quite a bit and adding in other plugins, etc etc etc.

    Today I ran into a strange problem. I think I know where it is coming from, but I'm not familiar enough with Javascript myself to remedy the situation.

    We're building a site that uses wookmark to display listings of items. On a mobile device, we want it to slim down to one column. It does this normally, but since we've been working on the code, the first item in our grid sits fine and dandy until it drops below a certain size. After the window size drops below that size, the first item jumps over about 50 pixels to the right.

    My instincts tell me that this is something to do with our CSS and how it's interacting with wookmark. The column generator is setting these to left:0; for all of them at that size, but once we drop below that window size (which varies depending on css), that first item jumps over.

    What's even stranger, is if the site is loaded on a mobile device under that size to begin with - no grid items appear at all, and our 'grid' area grows by 100s of % to the right.

    I'm completely puzzled. I'm probably at that 'looked at it too long' stage, so I thought I'd reach out and see if you might have any insights to offer me?

    Here is a screenshot showing the break: http://luskdesign.com/wook.jpg

    Footer not positioning correctly

    I have a container

    around my wookmark content and after I placed a footer
    with a relative position. However, the content is not pushing the footer down to the bottom of the page when scrolling like it's suppose to.

    Any ideas?

    Thanks,

    Jake

    EDIT: I should note that the top padding does work to lower the content below the 100px header.


    HTML:

    <div class="wrap">
        <div class="headerbg">
    
                    HEADER GOES HERE
    
        </div><!--end headerbg div-->
    
        <div class="main"> <!-- Container for content-->
            <div class="content">
    
                    CONTENT GOES HERE
    
            </div><!--end content div-->
        </div><!--end main div-->
    </div><!--end wrap div-->
    
    <div class="footer">
        <font class="footercopyright">
    
                    FOOTER GOES HERE
    
        </font>
    </div><!--footer div-->
    

    CSS:

    • {
      margin: 0; padding: 0;
      list-style-type: none;
      }

    .wrap {
    min-height: 100%;
    }

    .content{
    width: 80%;
    position: relative;
    }

    .main {
    width:100%;
    padding-top:120px;
    padding-bottom:60px;
    }

    .footer {
    position: relative;
    margin-top: -40px;
    height: 40px;
    clear:both;
    background-image:url('../images/bgfooter2.jpg');
    background-repeat:repeat-x;
    text-align:center;
    z-index:1;
    left:0px;
    width:100%;
    min-width:960px;
    }

    handler Click layout update

    In the index.html example you have:

    // Call the layout function.
          handler.wookmark(options);
    
          // Capture clicks on grid items.
          handler.click(function(){
            // Randomize the height of the clicked item.
            var newHeight = $('img', this).height() + Math.round(Math.random()*300+30);
            $(this).css('height', newHeight+'px');
    
            // Update the layout.
            handler.wookmark();
          });

    When I believe it should be

    // Call the layout function.
          handler.wookmark(options);
    
          // Capture clicks on grid items.
          handler.click(function(){
            // Randomize the height of the clicked item.
            var newHeight = $('img', this).height() + Math.round(Math.random()*300+30);
            $(this).css('height', newHeight+'px');
    
            // Update the layout.
            handler.wookmark(options);
          });

    Basically if you created the layout with the options, shouldn't those options also be passed on layout refresh?
    As a side note I did not look into the source code to make sure this was correct, but this fixed my issue when doing mouseover/click, which used to distort the layout.

    Enabling caching

    In the output function of simpleImage i've added:

    $numberOfDays = 10;

    and:
    header("Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H"), date("i"), date("s"), date("m"), date("d") + $numberOfDays, date("Y")))." GMT");

    after every header function in this function.

    And now it adds Expires so that browser caches image for 10 days.

    Ps. I don't know if it will work good for everyone because the script returns "file not found" first time to the browser and displays the image but don't know if when i set "expires" for file not found status than browser will handle it correctly. Maybe you know?

    issue with loading and readjusting

    I am having an issue with the script will load starting on the left of the page then adjust the left margin and load down the page. In mobile safari browser on the ipad it won't adjust to the left margin it just loads staying left justified on the page.

    I have tried it in Chrome and Firefox and the issue is the same.
    Can you tell me why it loads in this sequence and how do I get it to load from the center down?

    Also is there a way to speed up the load of new images when you get to the bottom of the page?

    thanks,
    RS

    Multi-width Items

    Hello, can I check with you whether it's possible to have multiple width for the items?

    Perhaps, we could have a css for the li class to define different width for the items?

    Thank you.

    bootstrap: place them right away

    Hi,

    It's not really an issue but I am wondering why in my code, I see all the divs being moved at the first page load while in your examples, (for instance: example-api): when I load the page, I see right away all the divs at their final place, you do not see them being moved to where there should be.

    I do not know if I make sense?

    Any idea why it behaves like that?

    Thanks.

    Using percentage for itemWidth

    Hi guys !

    Is there a way to set a percentage width for itemWidth ( for example : itemWidth: '20%' ).
    In this way, it would be possible to allocate the full container width.

    Thanks for your answer and sorry for my explanation.

    jquery 1.4.3 requirement

    It seems that the only reason you would need jquery 1.4.3 is for $.proxy... I am using it just fine with out the autoresize option with 1.3.2.

    Is there perhaps another way to do that call (I am not familiar with $.proxy)?

    404-status

    Hi,

    anybody know howto run $('#loaderCircle').hide(); if server ansvered 404-status page not found? With json loaded data.

    possible bottom animation

    Just wondering about the possibility of the new content in the infinity scroll version sliding in from the bottom rather than sliding in over already loaded content. Been hacking away at it for a bit but no joy yet

    documentation for enabling dynamic resize

    Its not covered here or on the web page but the js for enabling resize would be helpful to highlight.

    this.init = function() {
    $(window).resize($.proxy(this.resize, this));
    this.resize();
    };

    TypeError: this.wookmarkColumns[l] is undefined

    Got "TypeError: this.wookmarkColumns[l] is undefined" when i run

    $(document).ready(function(){

    // Prepare layout options.
    var options = {
        autoResize: true, // This will auto-update the layout when the browser window is resized.
        container: $('#list .span8 .thumbnails'), // Optional, used for some extra CSS styling
        offset: 16, // Optional, the distance between grid items
        itemWidth: 200 // Optional, the width of a grid item
    };
    
    // Get a reference to your grid items.
    var handler = $('.item');
    
    // Call the layout function.
    handler.wookmark(options);
    
    // Capture clicks on grid items.
    handler.click(function(){
        alert('HI');
        // Randomize the height of the clicked item.
        var newHeight = $('img', this).height() + Math.round(Math.random()*300+30);
        $(this).css('height', newHeight+'px');
    
        // Update the layout.
        handler.wookmark();
    });
    

    });

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.