Advertisement
nanorocks

crl_plugin

Feb 7th, 2018
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 2.41 KB | None | 0 0
  1. /*
  2. * clrJQ.js - JQuery plugin
  3. * lrJQ is JQuery mini-plugin that set positions to text,images and blocks.
  4. *
  5. * Name:         clrJQ.js
  6. * Author:       Andrej Nankov
  7. * Date:         july 23, 2015      
  8. * Version:      1.0
  9. * Example:      /
  10. *  
  11. */
  12.  
  13. (function( $ ) {
  14.    
  15.    
  16. $.fn.centerImg = function()
  17. {
  18.     $(this).css("display", "block");
  19.     $(this).css( { marginLeft : "auto", marginRight : "auto" } );
  20.     return this;
  21. }
  22. $.fn.centerImg = function(w,h)
  23. {
  24.     $(this).css("display", "block");
  25.     $(this).css( { marginLeft : "auto", marginRight : "auto" } );
  26.     $(this).innerHeight(h);
  27.     $(this).innerWidth(w);
  28.     return this;
  29. }
  30. $.fn.rightImg = function()
  31. {
  32.     $(this).css("float", "right");
  33.     $(this).css("clear", "both");
  34.     return this;
  35. }
  36. $.fn.rightImg = function(w,h)
  37. {
  38.     $(this).css("float", "right");
  39.     $(this).css("clear", "both");
  40.     $(this).innerWidth(w);
  41.     $(this).innerHeight(h);
  42.     return this;
  43. }
  44. $.fn.leftImg = function()
  45. {
  46.     $(this).css("float", "left");
  47.     $(this).css("clear", "both");
  48.     return this;
  49. }
  50. $.fn.leftImg = function(w,h)
  51. {
  52.     $(this).css("float", "left");
  53.     $(this).css("clear", "both");
  54.     $(this).innerWidth(w);
  55.     $(this).innerHeight(h);
  56.     return this;
  57. }
  58. $.fn.centerBlock = function(w)
  59. {
  60.     $(this).css("display", "block");
  61.     $(this).css( { marginLeft : "auto", marginRight : "auto" } );
  62.     $(this).innerWidth(w); 
  63.     return this;
  64. }
  65. $.fn.centerBlock = function(w,h)
  66. {
  67.     $(this).css("display", "block");
  68.     $(this).css( { marginLeft : "auto", marginRight : "auto" } );
  69.     $(this).innerWidth(w);
  70.     $(this).innerHeight(h);
  71.     return this;   
  72. }
  73. $.fn.rightBlock = function(w)
  74. {
  75.     $(this).css("float", "right");
  76.     $(this).css("clear", "both");
  77.     $(this).innerWidth(w);
  78.     return this;
  79. }
  80. $.fn.rightBlock = function(w,h)
  81. {
  82.     $(this).css("float", "right");
  83.     $(this).css("clear", "both");
  84.     $(this).innerWidth(w);
  85.     $(this).innerHeight(h);
  86.     return this;
  87. }
  88. $.fn.leftBlock = function(w)
  89. {
  90.     $(this).css("float", "left");
  91.     $(this).css("clear", "both");
  92.     $(this).innerWidth(w);
  93.     return this;
  94. }
  95. $.fn.leftBlock = function(w,h)
  96. {
  97.     $(this).css("float", "left");
  98.     $(this).css("clear", "both");
  99.     $(this).innerWidth(w);
  100.     $(this).innerHeight(h);
  101.     return this;
  102. }
  103. $.fn.centerText = function(w)
  104. {
  105.         $(this).css("text-align", "center");
  106.         return this;
  107. }
  108. $.fn.leftText = function(w)
  109. {
  110.         $(this).css("text-align", "left");
  111.         return this;
  112. }
  113. $.fn.rightText = function(w)
  114. {
  115.         $(this).css("text-align", "right");
  116.         return this;
  117. }
  118. }( jQuery ));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement