jQuery大小调整工具

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jQuery大小调整工具相关的知识,希望对你有一定的参考价值。

  1. $.fn.setOuterWidth = function(px) {
  2. var width = px -
  3. parseFloat(this.css('padding-left')) -
  4. parseFloat(this.css('padding-right')) -
  5. parseFloat(this.css('border-left-width')) -
  6. parseFloat(this.css('border-right-width'))
  7. return this.css('width', width + 'px')
  8. }
  9. $.fn.getOffsetRight = function() {
  10. return Math.round(this.outerWidth() + this.offset().left)
  11. }
  12. $.fn.getOffsetBottom = function() {
  13. return Math.round(this.outerHeight() + this.offset().top)
  14. }
  15. $.fn.isChildOf = function(node) {
  16. if (node instanceof $) {
  17. node = node[0]
  18. }
  19. if (!node) {
  20. return false
  21. }
  22. var child, i
  23. for (i = 0; i < this.length; i++) {
  24. child = this[i]
  25. do {
  26. child = child.parentNode
  27. if (child == node) {
  28. return true
  29. }
  30. }
  31. while (child)
  32. }
  33. return false
  34. }

以上是关于jQuery大小调整工具的主要内容,如果未能解决你的问题,请参考以下文章

Jquery调整图像大小

如何在 Windows 调整大小时调整所选 jquery 下拉列表的大小

使用 javascript/jquery 动态调整画布窗口的大小?

jquery检测窗口调整大小

jQuery在两边调整大小

jQuery动态比例元素/图像调整大小