I am trying to insert a div to a div cloned worse for example specifically to that, that is, what I want is that when you puncture a box and expand it appears not an area where I can put divs and then if I want to another box then something different, I guess I must use ID to accomplish the task but from then on I can not imagine how it can be This is my code until now
$("body").delegate('.box', 'click', function() {
if ($('.box.active').length <= 0) {
$(this).addClass('cloned');
var parent = $(this).parent().parent();
var pos = $(this).position();
var clone = $(this).clone().addClass('active');
$(this).css({
left: pos.left + 'px',
top: pos.top + 'px'
});
parent.append(clone);
clone.css({
position: 'fixed',
left: pos.left + 'px',
top: pos.top + 'px',
margin: '0 auto'
}).animate({
width: '100%',
height: '100%',
margin: '0 auto',
'z-index': '10',
top: 0,
left: 0
}, 300);
}
});
$("body").delegate('.box.active', 'click', function() {
var cloned = $('.box.cloned');
var clone = $('this');
var pos = cloned.position();
var w = cloned.width();
var h = cloned.height();
$(this).animate({
width: w + 'px',
height: h + 'px',
top: pos.top + 'px',
left: pos.left + 'px'
}, 300, function() {
$('.box.active').remove();
cloned.removeClass('cloned');
$(".greetings").removeClass('test');
});
});
$(window).ready(function() {
$(".bgCity ").click(function() {
$(".greetings").addClass('test');
});
$(".bgCity.active ").click(function() {
$(".greetings").removeClass('test');
});
$("#menu-toggle").click(function(e) {
e.preventDefault();
$("#wrapper").toggleClass("toggled");
});
$('button.btnbig').on('click', function(e) {
$(this).toggleClass('show');
});
var colors = ['orange', 'saddlebrown', 'royalblue', 'crimson', 'darkcyan', 'mediumvioletred', 'yellowgreen', 'indigo', 'green', 'olivedrab', 'thistle', 'darkolivegreen', 'chocolate', 'palevioletred', 'darkred', 'goldenrod', 'deepskyblue', 'slatblue', 'dodgerblue'];
var boxes = document.querySelectorAll(".box");
for (i = 0; i < boxes.length; i++) {
// Pick a random color from the array 'colors'.
boxes[i].style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
}
$(document).ready(function() {
$('.addJourn').click(function() {
var currentCount = $('.repeatingSection').length;
var newCount = currentCount + 1;
var lastRepeatingGroup = $('.repeatingSection').last();
var newSection = lastRepeatingGroup.clone();
newSection.insertAfter(lastRepeatingGroup);
newSection.find("select").each(function(index, select) {
select.id = select.id.replace("_" + currentCount, "_" + newCount);
select.name = select.name.replace("_" + currentCount, "_" + newCount);
select.onchange = function(event) {
onChange(event)
};
});
newSection.find("label").each(function(index, label) {
var l = $(label);
l.attr('for', l.attr('for').replace("_" + currentCount, "_" + newCount));
});
newSection.find('.hidden').css('display', 'none');
return false;
});
$('#j_id_1').change(function(event) {
onChange(event);
});
});
});
With this code I generate my clone boxes Any suggestion or help I would appreciate it enough