GithubHelp home page GithubHelp logo

fading about jquery-fastlivefilter HOT 8 CLOSED

awbush avatar awbush commented on July 16, 2024
fading

from jquery-fastlivefilter.

Comments (8)

awbush avatar awbush commented on July 16, 2024

There is no option for this because it is slow and distracting. You can use one of the slower alternatives if this is important, e.g. http://kilianvalkhof.com/uploads/listfilter/.

from jquery-fastlivefilter.

pcout avatar pcout commented on July 16, 2024

But can´t var oldDisplay = len > 0 ? lis[0].style.display : "block";
be changed to have a fadeIn() ?

Is it possible for me to alter the code a liitle bit ?

from jquery-fastlivefilter.

awbush avatar awbush commented on July 16, 2024

You're more than welcome to fork it, but the change isn't quite that simple (though it isn't too difficult): you'd just need to change all portions that reference li.style.display into something else, maybe li.fadeIn() or $(li).fadeIn() (not sure which, you'd have to test it)

from jquery-fastlivefilter.

awbush avatar awbush commented on July 16, 2024

This is probably the change you'd need:

=== modified file 'jquery.fastLiveFilter.js'
--- jquery.fastLiveFilter.js    2011-11-07 22:06:24 +0000
+++ jquery.fastLiveFilter.js    2011-11-08 18:18:55 +0000
@@ -32,12 +32,14 @@
            li = lis[i];
            if ((li.textContent || "").toLowerCase().indexOf(filter) >= 0) {
                if (li.style.display == "none") {
-                   li.style.display = oldDisplay;
+                   $(li).fadeIn();
                }
                numShown++;
            } else {
                if (li.style.display != "none") {
-                   li.style.display = "none";
+                   $(li).fadeOut();
                }
            }
        }

It might be faster to use jQuery's .each() instead of $(li) inside the loop. For small data sets, it may not matter much.

from jquery-fastlivefilter.

pcout avatar pcout commented on July 16, 2024

Thank you.
This worked.

What did you mean with using each() instead of $(li) ?
Is it like this ? $li.each().fadeOut();

from jquery-fastlivefilter.

awbush avatar awbush commented on July 16, 2024

No, it'd be more like the examples in the jQuery each() API, but after glancing at it I don't think it'd be any faster.

from jquery-fastlivefilter.

pcout avatar pcout commented on July 16, 2024

ok. thank you.
Nice work.

from jquery-fastlivefilter.

awbush avatar awbush commented on July 16, 2024

No problem! Glad I could help.

from jquery-fastlivefilter.

Related Issues (19)

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.