Guest User

Untitled

a guest
May 6th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. #allcomplex>div{
  2. margin-bottom: 10px;
  3. display:block;
  4. }
  5.  
  6. .complexmem{
  7. width: 40vw;
  8. height:10vw;
  9. background-color: yellowgreen;
  10. display: table-cell;
  11. vertical-align: middle;
  12. }
  13.  
  14. .complexmem>a>img{
  15. width: 7vw;
  16. height: 7vw;
  17. background-color: red;
  18. }
  19.  
  20. .complexmem>img{
  21. width: 12vw;
  22. height: 7vw;
  23. background-color: blue;
  24. }
  25.  
  26. .complexmem>.autotext{
  27. width: 20vw;
  28. height: 7vw;
  29. display:inline;
  30. color:white;
  31. background-color: green;
  32. }
  33.  
  34. <div id="allcomplex">
  35.  
  36. <div class="complexmem">
  37.  
  38. <a href="#">
  39. <img src="http://science-all.com/images/magnifying-glass-clipart/magnifying-glass-clipart-13.jpg">
  40. </a>
  41.  
  42. <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/2/26/Microchip_PIC24HJ32GP202.jpg/220px-Microchip_PIC24HJ32GP202.jpg">
  43.  
  44. <div class="autotext">
  45. <span>Computer Center Complex of microchip</span>
  46. </div>
  47.  
  48. </div>
  49.  
  50. <div class="complexmem">
  51.  
  52. <a href="#">
  53. <img src="http://science-all.com/images/magnifying-glass-clipart/magnifying-glass-clipart-13.jpg">
  54. </a>
  55.  
  56. <img src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/f8/PIC16CxxxWIN.JPG/220px-PIC16CxxxWIN.JPG">
  57.  
  58. <div class="autotext">
  59. <span>Laptop Center</span>
  60. </div>
  61.  
  62. </div>
  63.  
  64. </div>
  65.  
  66. function resizeFont(parElem, ratio) {
  67.  
  68. var parW = parElem.width();
  69. ratio = ratio || 7;
  70.  
  71. parElem.find('span').each(function () {
  72.  
  73. console.log($(this).width());
  74. console.log(parW);
  75. console.log(ratio);
  76.  
  77. $(this).css('font-size',
  78. parW / $(this).width() * ratio + 'px');
  79.  
  80. })
  81. }
  82.  
  83. resizeFont($(".autotext"));
Add Comment
Please, Sign In to add comment