site.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. function wrap(){
  2. $('#start > div:nth-child(-n+3)').wrapAll('<div class="top"></div> ')
  3. $('#start > div:nth-child(n+2)').wrapAll('<div class="bottom"></div> ')
  4. };
  5. function resize() {
  6. $(window).on("load resize", function() {
  7. $("#recits").resizable();
  8. // $( "#reseaux-sociaux" ).resizable();
  9. });
  10. }
  11. function drag() {
  12. var $hand = $( ".handler" );
  13. $hand.draggable({
  14. drag: function(){
  15. var offset = $(this).offset();
  16. var xPos = offset.left;
  17. var yPos = offset.top;
  18. $('#posX').text('x: ' + xPos);
  19. $('#posY').text('y: ' + yPos);
  20. console.log(yPos);
  21. var $recits = $(this).parent('#page').find('#recits');
  22. var $itw = $(this).parent('#page').find("#interviews");
  23. var $links = $(this).parent('#page').find("#links");
  24. var $rs = $(this).parent('#page').find("#reseaux-sociaux");
  25. var $grid1 = $(this).parent('.top');
  26. var $grid2 = $(this).parent('.bottom');
  27. $grid1.css('griqd-template-columns', xPos + 'auto auto' );
  28. $grid2.css('grid-template-columns', xPos + 'auto auto' );
  29. $recits.css('width', xPos);
  30. $rs.css('width', xPos);
  31. $recits.css('height', yPos);
  32. $itw.css('height', yPos);
  33. $links.css('height', yPos);
  34. }
  35. });
  36. };
  37. $(document).ready(function() {
  38. wrap();
  39. drag();
  40. // resize();
  41. });