Calcul dimension d'une div suivant son contenu


/ Published in: jQuery
Save to your folder(s)

Calcul de largeur (width) du conteneur en jquery suivant les dimension des élément contenu, ici pour jscrollpane


Copy this code and paste it in your HTML
  1. function exceptionScrollPane(){
  2.  
  3. var width = 0;
  4. var conteneurPanneau = jQuery('#wrapScrollPane');
  5.  
  6. jQuery('#conteneurScrollPane section').each(function() {
  7. width += jQuery(this).outerWidth( true );
  8. });
  9. jQuery('#conteneurScrollPane').css('width', width);
  10.  
  11.  
  12. conteneurPanneau.jScrollPane({
  13. showArrows: true,
  14. arrowButtonSpeed: 264,
  15. animateScroll: true
  16. });
  17.  
  18. }

Report this snippet


Comments


You need to login to view comments.