Code Monkey home page Code Monkey logo

quicksand's Introduction

Quicksand

jQuery plugin for reordering and filtering items with a nice shuffling animation like the one in this video.

Project site: https://razorjack.net/quicksand.

Demos & docs

Please visit the project site for live demos & documentation.

Usage

The following example would filter items in #content with shuffling animation, leaving only CMYK colors.

$("#content").quicksand($("#data > li"),
  {
    // all the parameters have sensible defaults
    // and in most cases can be optional
    duration: 1000,
    easing: "swing",
    attribute: "data-id",
  }
);

The markup could look like this:

<ol id="content" class="grid">
  <li data-id="red">Red</li>
  <li data-id="green">Green</li>
  <li data-id="blue">Blue</li>
  <li data-id="black">Black</li>
  <li data-id="white">White</li>
  <li data-id="yellow">Yellow</li>
  <li data-id="cyan">Cyan</li>
  <li data-id="magenta">Magenta</li>
</ol>

<ol id="data" style="display: none;">
  <li data-id="cyan">Cyan</li>
  <li data-id="magenta">Magenta</li>
  <li data-id="yellow">Yellow</li>
  <li data-id="black">Black</li>
</ol>

Please note that you need to set additional attribute (you can specify which one in options hash, by default it's data-id) so that the plugin can identify same elements within source and destination collections.

No additional CSS is required for the plugin to work. However, you should avoid styling the subject container using id selectors ---- please use class instead.

  • the subject (#content) is a container visible for the user
  • the first parameter ( $("#data > li") ) should contain a collection which will replace contents of the subject
  • duration - specifies duration (in milliseconds) of the animation effect, default: 750
  • easing - animation easing effect, default: 'swing'
  • attribute - attribute containing unique value able to identify same item within source and destination collection, default: 'data-id'
  • adjustHeight - 'dynamic' to animate height of the container (when the target collection is larger or smaller than source collection), 'call' to automatically set height before or after the animation, false to keep container height constant; default: 'call'
  • adjustWidth - Adjusts the width of container to fit all the items, 'call' for automatically adjusting before or after the animation (determined automatically), 'dynamic' for width adjustment animation, 'auto' to set the value to 'auto', false for not doing absolutely anything about it (useful on responsive pages).
  • useScaling - use CSS3 scaling effect, default: false
  • enhancement - function that performs custom visual enhancements (e.g. font replacements) on newly created items, default: function() {}. Since version 1.5 of this plugin, this shouldn't be required in most cases as elements created by jquery.quicksand are deep-cloned, which preserves their enhancements and attached events.

You can specify a callback function as an optional last argument.

Dependencies

Browser compatibility

Tested under:

  • Safari 4
  • Chrome 4
  • Firefox 3.5
  • Opera 10.15
  • Internet Explorer 7
  • Internet Explorer 8

No Internet Explorer 6 support is planned. Ever. The plugin, however, does not break your web application on IE6, it just skips the animation and replaces the collection immediately.

I recommend using the plugin with HTML5 markup but any other option is fine.

Custom attribute function

If you don't like HTML5 data-* attributes, you can specify a function instead.

$("#content").quicksand($("#data > li"),
  {
    // all the parameters have sensible defaults
    // and in most cases can be optional
    duration: 1000,
    easing: "swing",
    attribute: "data-id",
    attribute: function(v) {
      // different src of img means: different object
      return $(v).find('img').attr('src');
    }
  }
);

Integration with enhancement plugins

(This option shouldn't be needed if you use Quicksand v1.5 or higher)

Quicksand works fine with other plugins. Please note that:

  • when your items have functional enhancements (e.g. tooltips), remember to use callback to apply them on newly cloned objects:
$("#content").quicksand($("#data > li"),
  {
    duration: 1000,
  }, function() { // callback function
    $('#content a').tooltip();
  }
);
  • when your items are visually enhanced (e.g. font replacement), use enhancement function to refresh/apply during the animation
$("#content").quicksand($("#data > li"),
  {
    duration: 1000,
    enhancement: function() {
      Cufon.refresh('#content span');
    }
  }
);

Licensing

Copyright © 2010 Jacek Galanciak.

Dual licensed under MIT and GPL version 2 license.

In simple language: you don't get any warranty or promise of future maintenance of this library, but you can modify the code or use this library, without any limitations, in commercial products, including commercial website templates.

quicksand's People

Contributors

allanesquina avatar arlm avatar clinton3141 avatar databyte avatar erinzm avatar jonmcl avatar kachkaev avatar kiwiupover avatar razorjack avatar seanhussey avatar thomasyip avatar yorkie 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

quicksand's Issues

Breaking javascript calls

So im using quicksand to filter several anchors,
the anchors, when clicked call a function that alerts "hello world" and return false so u nvr leave the page,
on page load, i click anchor, it calls function, function alerts "hello world" and im all good,
but if i filter the anchors, then click the anchor, function never gets called.

how can i fix this?

Reread the items dimensions

Hi there,

I'm trying (without much success) to make QuickSand reread the items dimensions.

I have an example in which the items initially have one class that gives them one dimension, but, after a class change, they have a different dimensions. However, after the class change, when I run QuickSand again the items are being animated into their initial dimensions.

Is it possible to 'force' QuickSand reread these dimensions? Or, if this feature is not yet included in the plugin, is there any way I could hack together such an behavior?

Thank you in advance for your support and keep up the good work developing such awesome plugins,
Constantin TOVISI

Deep linking and jump to specific category

Is it possible for us to use quicksand in a way when we click a hyperlink on page 1, it'll jump to page 2(w/ quicksand) and selects the relevant category to start first.

Scenario:
On the 'NEWS' page, we see a "Picture A - (Category A)"
Would like to see it in further detail, we click on it,
and it jumps to our 'GALLERY' page, and jumps to "Category A" instead of "ALL"

HTML Clone doesn't work

Hi razorjack,

I have been trying to get this to work but to no avail! Seems like when a filtered list is created (even from cloned DOM), the rest of the 'li' items are lost forever and so filtering by any other type just removes the first matched items and the list is empty. I am using Jquery 1.4.2 with easing (but not using easing option for quicksand). Is there a limitation on what is contained within the

  • of the list?

    Thanks.

    _K

    UPDATE: Here's a snippet of my HTML and JS code -

    
    "
    • maximize
    • maximize
    • maximize
    <script> $('.banner').click(function(e) { var selected =' t1'; //or 't2 or 't3' var $completeList = $('.sortable'); var $data = $completeList.clone(); var $filteredData = $data.find('li[data-type=' + selected + ']'); $completeList.quicksand($filteredData, { duration: 800 }); e.preventDefault(); </script>"

    CSS for IE7 support

    Quicksand plugin is really amazing.
    However, I noticed that IE7 requires the following CSS to work properly (otherwise it throws an error and stops the script)
    html, body, div { border:0; }

    Hope that helps. Could be interesting to mention in the doucmentation

    Why not calling callback on IE6

    Hey,

    first of all, thanks for this amazing plugin.

    but I have a question... why are you not calling the callback function for IE6 ?
    It's ok for me to view animation skipped on IE6, but not the callback...

    So I use that :

       // Replace the collection and quit if IE6
       if ($.browser.msie && $.browser.version.substr(0,1)<7) {
              $sourceParent.html('').append($collection);
              if (typeof callbackFunction == 'function') {
                     callbackFunction.call(this);
              }
              return;
       }
    

    QuickSand not respecting the text-align style of parent in some cases

    I really like the quicksand plugin.
    However, I ran into an issue while developing on both Firefox and Google Chrome that has to do with the text-align style.

    In the following example, the source and destination are basically identical so no animation should be apparent. However, the first time you press the "Test" button, the items slide to the left.

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
    <html lang="en">
    <head>
        <title>Test Case</title>
        <meta http-equiv="Content-type" content="text/html;charset=UTF-8" >
        <link rel="stylesheet" type="text/css" href="test.css" />
        <script type="text/javascript" src="./jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="./jquery.quicksand.min.js"></script>
        <script type="text/javascript">
            var g_orig;
            var g_fb_orig_markup;
            var SPEED = 1000;
    
            $(document).ready(function() {
                //Save the original frame buffer markup.
                g_fb_orig_markup = $("#id_framebuffer").html();
    
                //Register the test button event handler.
                $("#id_test").click(function(e){
                    test();
                })
                ;
            })
            ;
    
            function test()
            {
                var fb = $("#id_framebuffer");
                //Restore the original frame buffer markup.
                fb.html(g_fb_orig_markup);
    
                var fb_inner = fb.find("#id_fb_inner");
    
                var fb_clone = fb.clone();
                var fb_inner_clone = fb_clone.find("#id_fb_inner");
                var fb_inner_temp = $("#id_fb_inner_temp");
                fb_inner_temp.html(fb_inner_clone.html());
    
                fb_inner.quicksand(fb_inner_clone.children(".container"), {
                    'attribute': 'id',
                    'duration' : SPEED
                })
                ;
            }
        </script>
        <style type='text/css'>
            body {
                background-color: teal;
            }
    
            #id_framebuffer {
                position: absolute;
                top: 0;
                left: 0;
                z-index: 100;
                background-color: teal;
                width: 100%;
                height: 100%;
            }
    
            #id_fb_inner, #id_fb_inner_temp {
                margin-top: 25%;
                text-align: center;
            }
    
            .container {
                display: inline-block;
                width: 7em;
                height: 7em;
                margin-left: 0.5em;
                margin-right: 0.5em;
            }
    
            .front {
                width: 7em;
                height: 7em;
                border: 2px solid black;
                background-color: cyan;
                text-align: center;
            }
    
            .centerer {
                text-align: center;
            }
    
            .hidden {
                display: none;
            }
        </style>
    </head>
    <body>
        <div id="id_framebuffer">
            <div id="id_fb_inner">
                <div id="id_cardback_1" class="container">
                    <div class="front">
                        <span>1</span>
                    </div>
                </div>
                <div id="id_cardback_2" class="container">
                    <div class="front">
                        <span>2</span>
                    </div>
                </div>
                <div id="id_cardback_3" class="container">
                    <div class="front">
                        <span>3</span>
                    </div>
                </div>
                <div id="id_cardback_4" class="container">
                    <div class="front">
                        <span>4</span>
                    </div>
                </div>
                <div id="id_cardback_5" class="container">
                    <div class="front">
                        <span>5</span>
                    </div>
                </div>
            </div>
    
            <div id="id_fb_inner_temp" class="hidden">
    
            </div>
            <div class="centerer">
                <button type="button" id="id_test">Test</button>
            </div>
        </div>
    </body>
    </html>
    

    I found that if I modified the source (around line 136):

    
                $dest.insertBefore($sourceParent);
    //PATCH -->
                $dest.css("text-align", $($sourceParent).css("text-align"));
    //PATCH <--
                $dest.css('opacity', 0.0);
    

    The issue went away.
    I also found I could work around the issue by moving the "text-align: center" style into the "#id_framebuffer" rule.

    Apparently does not work with google map

    Hi all
    On the same page I have a google map and quicksand, but apparently do not work together, if I comment on the tag where as the map, it works fine (quicksand), if i uncomment that tag, it stops working.

    e.g. 1 (quicksand not work)
    blockquote id="map_canvas" style="width: 430px; height: 430px; top: 0px; overflow: hidden;">

    e.g. 2 (quicksand work fine)

    Quicksand with fancy box

    Hey
    I have it working but as soon as i sort the list fancy box does not open and just opens in a new window. I think i need to use the callback function but i'm not sure how to use it it conjuction with my code. Please help it would be greatly appreciated.
    Here is a link http://dl.dropbox.com/u/2157175/grid.html

    Cheers
    Ben

    I want to use tooltip with quick sand

    well it is described over there but its very least to understand, can you please guide me how to use this tooltip with quicksand,
    http://www.sohtanaka.com/web-design/simple-tooltip-w-jquery-css/
    and the page where i am trying to use it is this
    http://letseedrop.blogspot.com/2011/01/testing-3.html
    i haven't added the soh tanaka tooltip script and css right now on the page, as i will add after hearing what to do.
    I tried alot of places like forums, i think atleast 10 but didn't got any help, one person and jquery
    forums do tried but he was not able to tell me to replace which code with what in my testing blog.

    integrating with Shadowbox, does no longer work after first clicking on a category

    Hi, I love the quicksand plugin but the doc is way too short for a jQuery beginner like me to understand the plugin. I have managed to get the quicksand plugin working by replicating the code on the quicksand website and now I am trying to integrate it with Shadowbox. After first clicking on a category, Shadowbox no longer works. I read something about a callback function but I do not understand at all how this could help to solve the problem. If anyone could tell me exactly what code I need to insert where, this would be much appreciated. Here is the link: http://michaelsieber.ch/cms/website.php?id=/de/referenzen_n.htm

    Thanks, Michael

    Integrating with Cufon give duplicated text on IE(7/8)

    This make me crazy. Quicksand goes smoothly with Cufon on all browser(FF,Chrome,Opera,Safari) except IE. The text is duplicated which stack each other, and give me this result http://plixi.com/p/81223277 . I used sorting one set of HTML (cloning) method in this case.

    As, described in the Quicksand doc, to enable Cufon on filtered element text I write this:

    el.quicksand(filteredData, {
        duration: 800,
        enhancement: function() {
            if(typeof Cufon !== 'undefined'){
               Cufon.refresh();
            }
       }
    });

    But it FAIL!!! Not fail on the most part, it displaying the Cufon text correctly, but there are another duplicates in the same context stacking each other which give you an ugly feeling.

    Then I suspect the problem lies upon cloning source, so I tried removing all cufon tag (which generated by Cufon upon replacing your text) from the cloned source, and replace it with normal text (as before Cufon take effect):

    filteredData.each(function() {
        var fEl = $(this);
        fEl.find('cufon').each(function() {
            var cEl = $(this);
            var cText = cEl.text();
                                
            cEl.replaceWith(cText);
        });                     
    });
    

    That is... but it's still fail!!! I wonder what's wrong in this case.

    IE issue with NaN on parseFloat($correctionParent.css('border-top-width'))

    I've integrated quicksand into a site i'm working on and came across this issue...

    I've fixed it but how do i submit a fix to the code (if my fix is ok, and it is deemed a bug that is ofcourse)?

    Regards,
    Dan

    BASE:
    correctionOffset.top -= parseFloat($correctionParent.css('border-top-width'));
    correctionOffset.left -= parseFloat($correctionParent.css('border-left-width'));

    FIX:
    var bTopWidth = parseFloat($correctionParent.css('border-top-width'));
    if ( !isNaN(bTopWidth) ) {
    correctionOffset.top -= bTopWidth;
    }
    var bLeftWidth = parseFloat($correctionParent.css('border-left-width'));
    if ( !isNaN(bLeftWidth) ) {
    correctionOffset.left -= bLeftWidth;
    }

    integration w/ other jquery plugins / applying callback

    gin dobre,
    i am trying to get quicksand to work with all of slidetoggle, jplayer and prettyphoto. as i am using code similar to the initial demo, i am unsure a to where & how to apply the callbacks - it must be right at the end, no? the final lines of my code are:

            $list.quicksand($sorted_data, $preferences);
            }
          e.preventDefault();
        });
      }); 
    });
    

    (the current dummy can be seen at weltrettung.org/audiocabbb )

    Footer passes through div containing quicksand while shuffling.

    Hi,

    The footer at the bottom seems to be passing through the div containing the quicksand plugin. You could try to click other categories, and it'll happen again.

    Razorjack managed to allow the div container to resize before the item list shuffles on http://razorjack.net/quicksand/demos/one-set-clone.html
    Is there a line i could fix?

    It'd be great if you could share your advice.
    Sample:
    http://www.urbanhair.com.sg/facelifttest/portfolio_shadowboxtest.html

    Problems with I.E 7 and 8

    I´m having some problems on applying the QS on a dropdownlist, in my case, i use differents htmls imports with ajax.

    In order to change dropdown content, the option value is loaded at $.get( $(this).attr('value'), function(data) ... and inserted at quicksand, it works fine in FireFox and Chrome, but in IE-7-8 it doesn´t work, and results an error at the quicksand JS.

    <select name="type">
        <option  disabled="disabled" selected="selected"> filtro de cases</option>
        <option value="ajax/todos.html" class="black">:: ALLS</option>
        <option class="gray" disabled="disabled">Examples</option>
        <option value="ajax/ajax-cars.html">:: Cars</option>
        <option value="ajax/ajax-trucks.html">:: Trucks</option>
    </select>
    

    //my externals html importeds are equals from this parts changing the number of LI.

            $(function() {
             $('#filter select[name="type"]').change(function(e) {
                    $.get( $(this).attr('value'), function(data) {
                        alert(data);
                         var $filteredData = $(data).find('li');
    
                        $('.itens').quicksand( $filteredData ,{adjustHeight: 'dynamic'} );
                }); 
                    e.preventDefault(); 
            });
           });
    

    The quicksand error reported by IE is at line 615 of quicksand JS file.

    Thank you very much for the plugin and please help me with this issue.

    Sorting with custom attributes

    Hello,

    I am using quicksand and been trying to get the sorting function to work with some custom tags, where at the moment it can sort by name and size only, id like it to sort with SpringSummer10 and AtumnWinter09. I have been racking my brains trying to sort it out, but cannot spot what i've done wrong. The links are below:

    http://www.gemmabishoplondon.com/collections3.html
    http://www.gemmabishoplondon.com/js/filter2.js

    I was wondering if you could point me in the right direction to get this issue resolved.

    Thank you very much in advance.

    Kind regards,

    Kish

    Integration with font-replacement systems

    This is more a feature request than anything, but I'm trying to integrate quicksand with a site that uses Cufon for font replacement (http://cufon.shoqolate.com/) and I'm getting a FOUC during the animation. Take a look at http://hunters.webfactional.com/ - click on a category, then another category - items that are new to the page will be loaded with the default font, which is replaced at the end of the animation (via a Cufon.refresh() call - see http://wiki.github.com/sorccu/cufon/api).

    I tried forking and adding a preCallback option but it didnt' work - I think what I need to do is do the font replacement right after the new node is inserted into the DOM, before the animation starts. Is it possible to add a callback that fires then?

    Images stack up like a vertical list in Firefox/IE when animating

    I've got a list of icons in a single row that I want to rearrange horizontally when one is clicked. It works perfectly in Chrome, but in IE and Firefox, everything moves into a single column on the animation before finally ending up in the right place at the end.

    I suspect I've got something wrong with my styling but I can't figure out why this is happening. I've got adjustHeight=false, and the container div and ul both have fixed heights, so I'm at a loss as to what else to try to resolve this.

    The site is here: http://www.outsharked.com/test and all the relevant js is in http://www.outsharked.com/test/scripts/outsharked.js . Any help would be much appreciated.

    Can not get this to work with jQuery 1.3+

    HI

    I love what this does but I just can not get it to work.

    I have placed the 'jquery.quicksand.js' in my code and the 'jquery-1.3.2.js' but nothing happens when I click the relevant links to filter out the images.

    If I copy the 'jquery.js' from your demo site it all works fine so not sure what is wrong. I need it to use the standard 'jquery-1.3.2.js' or 'jquery-1.3.2-min.js'.

    Hope you can help!

    Chris

    Integrating custom tooltips

    This is something I've been playing around with the last couple of days. Trying to integrate flowplayer's tooltip jquery plugin (http://flowplayer.org/tools/tooltip.html) with Quicksand. The tooltips show but then when I replace the content with Quicksand they no longer show up.

    Not quite sure what the problem is but maybe you could have a look and give me some pointers?

    I've uploaded the HTML, JS and related files here for now: http://tinyurl.com/yjxx98o

    Thanks very much.

    integrating with flowplayer tabs

    Hi all, I wanted to combine http://flowplayer.org/tools/demos/tabs/index.html with quicksand. Quicksand stops working after the 1st click. I integrated the tabs plugin the following way:

    1. in the head

      <script src="http://cdn.jquerytools.org/1.2.5/tiny/jquery.tools.min.js"></script>

      $(document).ready(function() {
      $(function() {
      // setup ul.tabs to work as tabs for each div directly under div.panes
      $("ul.tabs").tabs("div.panes > div");
      });

    2. in the main.js quicksand callback function:
      $list.quicksand($sorted_data, $preferences, function() {
      $(function() {
      $("ul.tabs").tabs("div.panes > div");
      });
      });

    You can find it under http://michaelsieber.ch/cms/website.php?id=/de/referenzen_n.htm .

    If anyone could help me, I would greatly appreciate it.

    Thanks, Michael

    Reverse the sorting way

    Hi,
    i know it is ony for animation but you have added some jquery to it, so it will be easy for you to tell me to replace what line with what. Your code sorts sizes from small to big sizes, i want it to do reverse of this, means that i want it to sort from big size to small.
    And 2nd thing is i want to use this size code two times so changing only id from size to size2 and placing the code 2 times will work?
    here is your code of sorting

    (function($) {
    $.fn.sorted = function(customOptions) {
    var options = {
    reversed: false,
    by: function(a) {
    return a.text();
    }
    };
    $.extend(options, customOptions);

    $data = $(this);
    arr = $data.get();
    arr.sort(function(a, b) {

    var valA = options.by($(a));
    var valB = options.by($(b));
    if (options.reversed) {
    return (valA < valB) ? 1 : (valA > valB) ? -1 : 0;
    } else {
    return (valA < valB) ? -1 : (valA > valB) ? 1 : 0;
    }
    });
    return $(arr);
    };

    })(jQuery);

    $(function() {

    var read_button = function(class_names) {
    var r = {
    selected: false,
    type: 0
    };
    for (var i=0; i < class_names.length; i++) {
    if (class_names[i].indexOf('selected-') == 0) {
    r.selected = true;
    }
    if (class_names[i].indexOf('segment-') == 0) {
    r.segment = class_names[i].split('-')[1];
    }
    };
    return r;
    };

    var determine_sort = function($buttons) {
    var $selected = $buttons.parent().filter('[class*="selected-"]');
    return $selected.find('a').attr('data-value');
    };

    var determine_kind = function($buttons) {
    var $selected = $buttons.parent().filter('[class*="selected-"]');
    return $selected.find('a').attr('data-value');
    };

    var $preferences = {
    duration: 800,
    easing: 'easeInOutQuad',
    adjustHeight: false
    };

    var $list = $('#list');
    var $data = $list.clone();

    var $controls = $('ul.splitter ul');

    $controls.each(function(i) {

    var $control = $(this);
    var $buttons = $control.find('a');

    $buttons.bind('click', function(e) {

    var $button = $(this);
    var $button_container = $button.parent();
    var button_properties = read_button($button_container.attr('class').split(' '));
    var selected = button_properties.selected;
    var button_segment = button_properties.segment;

    if (!selected) {

    $buttons.parent().removeClass('selected-0').removeClass('selected-1').removeClass('selected-2');
    $button_container.addClass('selected-' + button_segment);

    var sorting_type = determine_sort($controls.eq(1).find('a'));
    var sorting_kind = determine_kind($controls.eq(0).find('a'));

    if (sorting_kind == 'all') {
    var $filtered_data = $data.find('li');
    } else {
    var $filtered_data = $data.find('li.' + sorting_kind);
    }

    if (sorting_type == 'size') {
    var $sorted_data = $filtered_data.sorted({
    by: function(v) {
    return parseFloat($(v).find('span').text());
    }
    });
    } else {
    var $sorted_data = $filtered_data.sorted({
    by: function(v) {
    return $(v).find('strong').text().toLowerCase();
    }
    });
    }

    $list.quicksand($sorted_data, $preferences);

    }

    e.preventDefault();
    });

    });

    var high_performance = true;
    var $performance_container = $('#performance-toggle');
    var $original_html = $performance_container.html();

    $performance_container.find('a').live('click', function(e) {
    if (high_performance) {
    $preferences.useScaling = false;
    $performance_container.html('CSS3 scaling turned off. Try the demo again. Reverse.');
    high_performance = false;
    } else {
    $preferences.useScaling = true;
    $performance_container.html($original_html);
    high_performance = true;
    }
    e.preventDefault();
    });

    });

    thank you for your time.

    Sorting by date

    Can we sort out items by date in quicksand, if yes please give me a piece of code and do tell me where to paste it, i mean after which line of code, i am using your script of the demo on the main screen.http://razorjack.net/quicksand/
    I like quicksand a lot, its one of the best jquery i have seen.

    trying to integrate quicksand with garage door effect

    Hi Razor,

    I've been trying to integrate quicksand with Gaya Design's garage door effect. It works the first time, however the garage door effect stops working when the images shuffle.
    Please, let me know what I can do to fix this and where I can place the code.

    Garage door effect: http://www.gayadesign.com/diy/jquery-convertion-garagedoor-effect-using-javascript/

    My little experiment: http://dl.dropbox.com/u/1519218/portfolio/index.html

    Elif

    Use with masonry

    I'm confused.

    I see in your script for the demo page that you are using data-value for the menu to display items. However, that isn't in the script for quicksand and I don't see how to make the call for the items. I used a href="#" data-id="group". I hope that's correct.

    Additionally, I'm trying to get this to work with jquery masonry with no luck at all.

    masonry uses divs and so I replaced li in the call in the head with div, but this did not work.

    When the page loads you see the masonry divs and then they all fade and ease off screen.

    Thoughts?

    Elements disappearing

    I'm having an issue where my elements all disappear and aren't being recreated. I'm using the clone method. Firebug isn't throwing any errors so I'm not sure what's going on.

    No scaling

    I downloaded the scaling plugin, but I get no scaling. When I set useScaling to true, nothing happens, and in Safari I get no sorting anymore (it breaks).

    All widths and sizes are set in pixels.

    Here's the code I'm using:

    <script type="text/javascript" src="jquery.easing.1.3.js"></script>
    <script type="text/javascript" src="jquery.quicksand.js"></script>
    <script type="text/javascript" src="jquery-animate-css-rotate-scale.js"></script>
    <script type="text/javascript">
    
     jQuery(document).ready(function() {
    
     var $filterType = $('.splitter a');
    
     // get the first collection
     var $applications = $('#list');
    
      // clone applications to get a second collection
      var $data = $applications.clone();
    
     // attempt to call Quicksand on every form change
      $filterType.click(function(e) {
       if ($(this).attr('data-value') == 'all') {
         var $filteredData = $data.find('li');
       } else {
         var $filteredData = $data.find('li.' + $(this).attr('data-value'));
       }
    
       // finally, call quicksand
       $applications.quicksand($filteredData, {
         duration: 1000,
         easing: 'easeInOutQuad'
       });
       return false;
      });
    
    });
    
    </script>
    

    the way multiple tag filtering works...

    Hi,

    I'm a bit of a jquery noob so please don't shout if I'm just being an idiot (just call me one nicely ;) but...

    when I've got multiple tags, I'm wanting to only display matches that have "both", not "either"... I'm guessing its a case of just changing an "OR" to an "AND" somewhere? or at least the equivalent of this?

    eg. clicking "web" and "directors" should only give me 1 result, as there is only one director in web, but what happens is that its giving me -all- the people in web and -all- the directors....

    MUCH appreciated if anyone can help me in this pickle!

    Jamie

    Multiple data-types per Item

    Hi razorjack,

    love ur work so far, but i have a little question for you. :)
    I'd like to show my items in multiple categories, so i tried the following enhancement:

    if ($($filterType+':checked').val() == 'all') {
    var $filteredData = $data.find('li');
    } else {
    var $filteredData = $data.find('li[data-type=' + $($filterType+":checked").val() + ']');
    var $filteredData = $data.find('li[data-type-2=' + $($filterType+":checked").val() + ']');
    var $filteredData = $data.find('li[data-type-3=' + $($filterType+":checked").val() + ']');
    }

    Template:
    li data-id="id-1" data-type="category1" data-type-2="category2" data-type-3="category3"

    The problem is, my item is only shown in the 3rd category.
    Any suggestions? Thanks in advance.

    Height applied to container

    Is there a way to remove the height that is applied to the containing

      that holds the elements for quicksand? I am using this functionality as a base (http://razorjack.net/quicksand), but have modified it to hold a div with variable content. Everything is working well, but I need to eliminate the style that is applied to the containing unordered list. In firebug the style looks like this: element.style{height:1000px}; the height is varies, depending on the elements inside. Setting the height to auto or dynamic doesn't seem to help, I end up with a lot of extra space at the end of the page. While in firebug, I can turn the "element.style{height:1000px}; " off and my page works as intended. Any ideas?

      I would post a link, but the site I am working on is password protected and it is not my place to change or give out that information.

      Thank you.

    Images piling up then suddenly moving into place

    I've been trying to implement the plugin here http://posters.tn-uk.net/test. When I select from the dropdown something like "ICT Services" or "Student's Union" all of the posters disappear, then the right posters seem to pile up in the left hand side then suddenly move into place. Also I'm not getting the nice animation using easeInOutQuad they just seem to fade instead. In any case great plugin, thanks!

    Spaces in data-ids

    I noticed that I was getting a rawDestElement is undefined error whenever I was filtering down items. The error was only coming up when I was trying to quicksand one list to a completely different list ([a,b] to [c]). Something was causing my destElement array inside the $collection.each method to be null. I started debugging and noticed that if I changed:
    destElement = $collection.filter('[' + options.attribute + '=' + $(this).attr(options.attribute) + ']');

    to

    destElement = $collection.filter('[' + options.attribute + '="' + $(this).attr(options.attribute) + '"]');

    that it worked as expected with no javascript error. The filter function appears to need quotes around the value to be checked if it has spaces. I'm still partially confused as to why this was not affecting things in a normal use case since it seems like the data should still be filtered out erroneously regardless of whether or not it was in the original list.

    latest quicksand.min.js and still getting error invalid argument in IE

    I am using the latest quicksand.min.js code and I am still getting an invalid argument error, and it seems to be failing on the following line: h.style.top=s[f].top-parseFloat(h.style.marginTop)-e.top+"px". I have no idea what is going on, it is working beautifully in Firefox, but my client also needs it to work in IE

    "Advanced: Sorting one set of HTML (cloning)" appears not to work.

    I've been trying to recreate the "Advanced: Sorting one set of HTML (cloning)" demonstration without success, I ended up copying the provided code exactly from the page (linking to jQuery & including the plugin of course) yet it still does not work.

    Is it working for anyone else?

    IE7 support.

    the demo at least is still pretty nasty in IE7.
    i'm not sure if its the fault of the demo or something the script can do better
    but it'd be great to see some polish there if possible.
    :)

    Further sorting of the results

    Hey

    I have set up your excellent quicksand script and its (so far) all working well. My question is this.

    In your "Advanced: Sorting one set of HTML (cloning)" example demo, after the person has clicked on the fist option, say "Applications", they can then further sort the items into either size or name (alphabetical order). How can this be modified so that the items are further sorted not by name or size but by another criteria such as they have been in the first step (e.g. first sorted by applications, then the type of application, e.g. game, music apps etc etc?

    I am using the code from the main page that makes use of classes to currently identify the correct kind, e.g. app or utility

    Would it be possible to have something along the lines of

    if (sorting_type == 'game') {
    var $sorted_data = $filtered_data.sorted({
    by: function(v) {
    return all games from the first sorted list of applications
    }
    });
    }

    If that does not make any sense, I will happily try and explain further!

    All replays are awesome and very much appreciated!

    Many Thanks
    Macy

    issue with webusercontrol on same page

    I successfully have this awesome plugin working just fine in my asp web application.

    But then I added a usercontrol to the page and it completely broke the plugin. Removing the usercontrol reference (<uc2:details ID="details1" runat="server" />) fixes the problem.

    How can I still use this plugin and keep my usercontrol on the page?

    Enhancement not working with hover and lightbox functions

    I am using quicksand for some thumbnail images along with a lightbox plugin (to open a bigger image when clicked on thumbs) and native hover function. Apparently both of them does not work when Quicksand is loaded. I found that by using 'enhancement' argument one can refresh bindings. I am using "enhancement: function() {$('img').hover();" as one of the argument in Quicksand plugin but can't seem to get through. Can anyone tell me the solution? Razorjack??

    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.