JQuery - Controversia entre 2 formularios

   
Vista:

Controversia entre 2 formularios

Publicado por Jose Luis (1 intervención) el 10/12/2012 03:16:27
Hola amigos, tengo un problema entre 2 formularios de jquery y la verdad es que no encuentro el problema.
La cuestion es que tenia este en el html y funcionaba perfectamente
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<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>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder