
$(document).ready(function() {


$('.jqhorzdrag').each(function(){
  $(this).wrapInner("<div class='e-jqhorzdrag-inner-content'></div>");
  $(this).wrapInner("<div class='e-jqhorzdrag-content'></div>");
  var main=$(this);
  $(this).css({
    'overflow': 'hidden',
    'width': '100%'
  });
  $('.e-jqhorzdrag-content',this).css({
    'white-space': 'nowrap'
  });
  $('.e-jqhorzdrag-inner-content',this).css({
    'display': 'inline-block',
    'width':'max-content'
  });

  // var totalWidth = 0;
  // $('.e-jqhorzdrag-inner-content > *',this).each(function() {
  //   totalWidth += $(this).outerWidth(true);
  // });
  //
  // $('.e-jqhorzdrag-inner-content',this).width(totalWidth);


  // Make content draggable horizontally
  Draggable.create($('.e-jqhorzdrag-inner-content',this), {
    type: 'x',
    allowContextMenu:true,
    edgeResistance: 0.19,
    bounds: $(this),
    cursor: 'grab',
    throwProps: true,
   overshootTolerance: 0.1,
    ease: Expo.easeInOut,
    onDragStart: function() {
    main.closest("section").addClass('alreadydragged');
    $("body").addClass('dragging');
  },
  onDragEnd: function() {
  $("body").removeClass('dragging');

  }
  });

});
});
$( window ).resize(function() {

});
