La cuestion es que tenia este en el html y funcionaba perfectamente
Código Javascript :
var productList = function () {
return {
setup: function (a) {
if (!this.setupComplete) {
$(document).ready(function () {
productList.allItem();
if($('#loadmore').length) {
$('#loadmore').data('num',$('.product').length);
$('#loadmore a').click(function() {
var d = $(this).parents('#loadmore');
var all = ($('#loadmore').attr('rel')*1) - $('.product').length;
var e = '';
$('#loadmore').hide();
$('#loading').show();
$('.product_ids').each(function () {
if(e) e += ',';
e += $(this).text();
});
$.ajax({
type: 'GET',
url: $(this).attr('rel'),
data: { 'product_ids':e },
success: function(response) {
$('#products').append($(response).fadeIn(' slow'));
productList.allItem();
$('#loadmore').show();
$('#loading').hide();
$('.product_ids').hide();
if(all <= $('#loadmore').data('num')) $('#loadmore').remove();
}
});
});
}
});
$(window).resize(_.throttle(function () {
productList.allItem()
}, 200));
this.setupComplete = true
}
},
itemHolder: "#productList",
itemArray: [],
orderedItem: [],
mappedItem: {},
columnCount: 1,
columns: 0,
columnWidthInner: 250,
columnMargin: 12,
columnPadding: 30,
columnBorder: 2,
allItem: function () {
var a = $(this.itemHolder + " .product"),
c = document.documentElement.clientWidth;
this.columnWidthOuter = this.columnWidthInner + this.columnMargin + this.columnPadding + this.columnBorder;
this.columns = Math.max(this.columnCount, parseInt(c / this.columnWidthOuter));
if (a.length < this.columns) this.columns = Math.max(this.columnCount, a.length);
c = this.columnWidthOuter * this.columns - this.columnMargin;
var d = document.getElementById("productList");
if (d) d.style.width = c + "px";
for (c = 0; c < this.columns; c++) this.itemArray[c] = 0;
this.flowItem(a, true);
if ($("#products .product").length === 0 && window.location.pathname === "/") {
$("#products").addClass("empty");
setTimeout(function () {
window.location.reload()
}, 5E3)
}
},
flowItem: function (a, c) {
if (c) {
this.mappedItem = {};
this.orderedItem = []
}
if (this.itemArray.length > this.columns) this.itemArray = this.itemArray.slice(0, this.columns);
for (i = 0; i < a.length; i++) {
c = a[i];
var d = $(c).attr("data-id");
if (d && this.mappedItem[d]) $(c).remove();
else {
var e = jQuery.inArray(Math.min.apply(Math, this.itemArray), this.itemArray),
f = this.itemArray[e];
c.style.top = f + "px";
c.style.left = e * this.columnWidthOuter + "px";
this.itemArray[e] = f + c.offsetHeight + this.columnMargin;
this.mappedItem[d] = this.orderedItem.length;
this.orderedItem.push(d)
}
}
$("#productList").css('min-height',(Math.max.apply(Math, this.itemArray)) + "px");
this.showItem();
},
showItem: function () {
$.browser.msie && parseInt($.browser.version);
var a = $(this.itemHolder);
setTimeout(function () {
a.css({ visibility: "visible" })
}, 250)
}
}
}();
(function() {
var root = this;
var _ = function(obj) { return new wrapper(obj); };
root['_'] = _;
_.throttle = function(func, wait) {
var context, args, timeout, throttling, more, result;
var whenDone = _.debounce(function(){ more = throttling = false; }, wait);
return function() {
context = this; args = arguments;
var later = function() {
timeout = null;
if (more) func.apply(context, args);
whenDone();
};
if (!timeout) timeout = setTimeout(later, wait);
if (throttling) {
more = true;
} else {
result = func.apply(context, args);
}
whenDone();
throttling = true;
return result;
};
};
_.debounce = function(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
if (immediate && !timeout) func.apply(context, args);
clearTimeout(timeout);
timeout = setTimeout(later, wait);
};
};
}).call(this);
productList.setup();Y posteriormente he insertado este script para la animacion de una cartela y resulta que directamente me invalida o anula al anterior. Si encontrais el problema os lo agradeceria.
Código Javascript :
<script type="text/javascript">
function $(selector) {
return document.querySelectorAll(selector)[0];
}
function abrir(example, fn) {
$('#abrir' + example + ' .abrir').addEventListener('click', function(e){
e.preventDefault();
fn();
}, false);
}
function cerrar(example, fn) {
$('#cerrar' + example + ' .cerrar').addEventListener('click', function(e){
e.preventDefault();
fn();
}, false);
}
addEventListener('DOMContentLoaded', function(){
abrir(2, function(){
move('.contenido')
.set('margin-top', 250)
.end();
});
cerrar(2, function(){
move('.contenido')
.set('margin-top', 0)
.end();
});
}, false);
</script> 