Question: I have one page with slider with images and names of category, and second page with gallery and on this page is another slider with category icons. When you click on slider1 it shoud redirect you to page2 (gallery) and set slider2 to right positions, I mean slider2 shoud jump to proper slide with exactly the same category to show right pictures in gallery.
Redirecting was no problem to me but I don't know how I should write the functions after redirecting to page.
Right now I have

```
 var slide_jump;  
 $('div.zobacz').bind("click touchstart", function() {

    slide_jump = glide2.current(); //get number of slide on slider1 to know to which slide should jump slider2

    setTimeout(function() {//redirecting must be after I get current slide on slider1
        var url = "http:***.html";
        $(location).attr('href', url);
    }, 100);
 //HERE IS MY PROBLEM
}); 

```

there is a function : `slider2.jump(slide_jump)` - slider2 jump to proper slide, but I dont know were I shoud use it. it should be after the page2 load, i know there is something like 

```
$(window).load(); $(document).ready(); 

```

but should I use it know? if everything is already in something like this.

Answer: 
You can loop through your filter parameters, using the `key` to check it's value against that in the current iteration of `json`:

```
var filterParameters = {color: "red", size: "small"};
var jsonFiltered = $.grep(json, function (j) {
    filter = true;
    $.each(filterParameters, function(i, v){
        filter = j[i] != v ? false : filter
    });
    return filter;
});

```

[**JSFiddle**](http://jsfiddle.net/pxjLhoqo/1/)
use [Object.keys](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) to iterate. keys returns all properties of your object as a new array.

```
var keys = Object.keys(filterParameters);
keys.length --> 2
keys[0] ---> "color"

for(i=0;len=keys.length;i<len;i++){
   //filterParameters[keys[i]] do some processing here.
}

```

P.S: this won't work on IE < 9