I am dealing with strange issue, but that should be a simple solution as my mind totally stuck I don't know where I am going wrong, simply I want to put my function thrice as shown below in example:
If my function is :
function(){
if (jQuery('#gallery-v').length) {
var $container = jQuery('#gallery-v');
alert($container);
$container.imagesLoaded( function(){
$container.isotope({
filter: '*',
animationOptions: {
duration: 750,
easing: 'linear',
queue: false
}
});
});
jQuery('#filterlist_v a').click(function() {
alert(this);
jQuery('#filterlist_v .current').removeClass('current');
jQuery(this).addClass('current');
var selector = jQuery(this).attr('data-filter');
$container.isotope({
filter: selector,
animationOptions: {
duration: 750,
easing: 'linear',
queue: false
}
});
return false;
});
}
}
I simply want it to be two times more by just incrementing my selector value like '#gallery-v' to '#gallery-v1' and for '#filterlist_v a' to '#filterlist_v1 a' just simply increment my gallery-v by 1 in first iteration 2 in second and so on etc ...
Here is my code which I tried:
var count = 2;
for(var i = 0; i < count; i++){
function(){
if (jQuery('#gallery-v' +i +'').length) {
var $container = jQuery('#gallery-v' +i +'');
alert($container);
$container.imagesLoaded( function(){
$container.isotope({
filter: '*',
animationOptions: {
duration: 750,
easing: 'linear',
queue: false
}
});
});
jQuery('#filterlist_v' +i +' a').click(function() {
alert(this);
jQuery('#filterlist_v +i +' .current').removeClass('current');
jQuery(this).addClass('current');
var selector = jQuery(this).attr('data-filter');
$container.isotope({
filter: selector,
animationOptions: {
duration: 750,
easing: 'linear',
queue: false
}
});
return false;
});
}
}
}
but its not printing my code in my js file as I wanted :( what's going on wrong please ???