integration/js/main.js
changeset 19 43ac4bd80e71
parent 11 265a5f1cc7cf
parent 18 c85b323f5174
child 20 c0bb6a59f587
equal deleted inserted replaced
11:265a5f1cc7cf 19:43ac4bd80e71
     1 $(function(){
       
     2 	//$("div.popin").hide();
       
     3 	$("a.open-popin").bind("click",function(e){
       
     4 		e.preventDefault();
       
     5 		var target = $(this).attr("href");
       
     6 		if($(target).is(':visible')){
       
     7 			$(target).hide();
       
     8 		}else{
       
     9 			$(target).show();
       
    10 		}
       
    11 	});
       
    12 	//video sortable
       
    13 	$("ul.tools li a.disable").bind("click",function(e){e.preventDefault();});
       
    14 	disableMoveItemVideo();
       
    15 	function disableMoveItemVideo(){
       
    16 		$(".list-video#sortable ul.tools li a.top.disable, .list-video#sortable ul.tools li a.bottom.disable").removeClass("disable");
       
    17 			var listVideo = $(".list-video#sortable");
       
    18 			var firstItem = listVideo.find("li:first-child");
       
    19 			var lastItem = listVideo.find("li:last-child");
       
    20 			firstItem.find("ul.tools li a.top").addClass("disable");
       
    21 			lastItem.find("ul.tools li a.bottom").addClass("disable");
       
    22 	}
       
    23 	$(".list-video#sortable ul.tools li a.top,.list-video#sortable ul.tools li a.bottom ").bind("click",function(e){
       
    24 		e.preventDefault();
       
    25 		var currentItem = $(this).parents("li.item-video");
       
    26 
       
    27 		if($(this).hasClass("top")){
       
    28 			var itemPrev = currentItem.prev();
       
    29 			currentItem.insertBefore(currentItem.prev());
       
    30 		}else if($(this).hasClass("bottom")){
       
    31 			currentItem.insertAfter(currentItem.next());
       
    32 		}
       
    33 		
       
    34 		disableMoveItemVideo();
       
    35 	});
       
    36 	$( "#sortable" ).sortable({
       
    37 		stop : function(){
       
    38 			disableMoveItemVideo();
       
    39 		}
       
    40 	});
       
    41 });//jQuery