|
@@ -1,31 +1,147 @@
|
|
|
-var $culturelle = $('#text_figli p > a:nth-of-type(3)');
|
|
|
+var $link_txt = $('#text_figli p > a');
|
|
|
+var $link_list = $('.list-projets a');
|
|
|
+
|
|
|
+function ajax_txt($href,$this, this_id) {
|
|
|
+ var $link_txt = $('#text_figli > p');
|
|
|
+ var idlink_txt = $link_txt.attr("id");
|
|
|
+ var search_id =$link_txt.find('#' + this_id);
|
|
|
|
|
|
-function ajax() {
|
|
|
$.ajax({
|
|
|
- url : 'projets/culturelle.html',
|
|
|
+ url : $href,
|
|
|
type : 'GET',
|
|
|
dataType:'html',
|
|
|
success: function(data) {
|
|
|
- $(data).find('.card').insertAfter($culturelle);
|
|
|
+ $(data).find('.card').addClass(this_id).insertAfter(search_id);
|
|
|
+
|
|
|
+ var $card = $('#text_figli .card .card-image > a');
|
|
|
+
|
|
|
+ $card.click(function(e) {
|
|
|
+ e.preventDefault();
|
|
|
+ var $this = $(this);
|
|
|
+ var $href = $this.attr("href");
|
|
|
+ var this_id = $this.parent('.card-image').attr("id");
|
|
|
+
|
|
|
+ if ($this.parent('.card-image').hasClass('views')) {
|
|
|
+ $('#'+this_id+' #item').remove();
|
|
|
+ $this.parent('.card-image').removeClass("views");
|
|
|
+ }else{
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ url : $href,
|
|
|
+ type : 'GET',
|
|
|
+ dataType:'html',
|
|
|
+ success: function(data) {
|
|
|
+ $(data).find('#item').insertAfter($this);
|
|
|
+
|
|
|
+ $(window).on('resize', function(x){
|
|
|
+ var x = $this.offset();
|
|
|
+ var x = $this.offset();
|
|
|
+ var Wwindow = $('#text_figli').width();
|
|
|
+ var Wcard = $this.parents('.card').width();
|
|
|
+ var xcard = $this.offset().left;
|
|
|
+ var marginR = Wwindow - (Wcard + xcard);
|
|
|
+
|
|
|
+ console.log('x.left resize =',x.left);
|
|
|
+ $this.parent('.card-image').find('#item').css('margin-left', -x.left+8);
|
|
|
+ $this.parents('.card').css('margin-right', marginR);
|
|
|
+ });
|
|
|
+
|
|
|
+ var x = $this.offset();
|
|
|
+ var Wwindow = $('#text_figli').width();
|
|
|
+ var Wcard = $this.parents('.card').width();
|
|
|
+ var xcard = $this.offset().left;
|
|
|
+ var marginR = Wwindow - (Wcard + xcard);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ console.log('marginR', marginR);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ $this.parent('.card-image').find('#item').css('margin-left', -x.left+8);
|
|
|
+ $this.parents('.card').css('margin-right', marginR);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $this.parent('.card-image').addClass('views');
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function ajax_liste($href,$this, this_id) {
|
|
|
+ var $link_txt = $('#text_figli > p');
|
|
|
+ var idlink_txt = $link_txt.attr("id");
|
|
|
+ var search_id =$link_txt.find('#' + this_id);
|
|
|
+
|
|
|
+ console.log('$href',$href);
|
|
|
+ var url = $href.split("/");
|
|
|
+ var id = url[url.length - 2];
|
|
|
+ var projetc_name = url[url.length - 1];
|
|
|
+ console.log('projetc_name',projetc_name);
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ url : '/projets/' + id,
|
|
|
+ type : 'GET',
|
|
|
+ dataType:'html',
|
|
|
+ success: function(data) {
|
|
|
+ $(data).find('.card').addClass(this_id).insertAfter(search_id);
|
|
|
+ },
|
|
|
+ complete: function(){
|
|
|
+
|
|
|
+ setTimeout( function(){
|
|
|
+ $.ajax({
|
|
|
+ url : '/projets/' + id + '/' + projetc_name,
|
|
|
+ type : 'GET',
|
|
|
+ dataType:'html',
|
|
|
+ success: function(data) {
|
|
|
+ var $link_item = $('#text_figli > p > .card');
|
|
|
+ var idlink_txt = $link_txt.attr("id");
|
|
|
+ var search_id =$link_item.find('#' + projetc_name);
|
|
|
+ console.log('search_id',id);
|
|
|
+ $(data).find('#item').insertAfter(search_id);
|
|
|
+ console.log('complete2');
|
|
|
+ },
|
|
|
+ })
|
|
|
+ }, 2000);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
function deploy() {
|
|
|
- $culturelle.click(function(e){
|
|
|
- $(this).addClass('marg');
|
|
|
- e.preventDefault()
|
|
|
-
|
|
|
- var $detectCard = $('#text_figli > p > .card');
|
|
|
- if ($detectCard[0]) {
|
|
|
- console.log(true);
|
|
|
- $(".card").remove();
|
|
|
- $(this).removeClass("marg");
|
|
|
+ $link_txt.click(function(e){
|
|
|
+ e.preventDefault();
|
|
|
+ var $this = $(this);
|
|
|
+ var $href = $this.attr("href");
|
|
|
+ var this_id = $this.attr("id");
|
|
|
+
|
|
|
+ if ($this.hasClass('open')) {
|
|
|
+ $('.card.'+this_id).remove();
|
|
|
+ $this.removeClass("open");
|
|
|
}else{
|
|
|
- console.log(false);
|
|
|
- ajax();
|
|
|
+ ajax_txt($href, $this, this_id);
|
|
|
+ $this.addClass('open');
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
+ $link_list.click(function(e){
|
|
|
+ e.preventDefault();
|
|
|
+ var $this = $(this);
|
|
|
+ var $href = $this.attr("href");
|
|
|
+ var this_id = $this.attr("id");
|
|
|
+
|
|
|
+ if ($this.hasClass('open')) {
|
|
|
+ $('.card.'+this_id).remove();
|
|
|
+ $this.removeClass("open");
|
|
|
+ }else{
|
|
|
+ ajax_liste($href, $this, this_id);
|
|
|
+ $this.addClass('open');
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
}
|
|
|
|
|
|
jQuery(document).ready(function($){
|