jresize.min.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. (function(a) {
  2. a.jResize = function(c) {
  3. a.jResize.defaults = {
  4. viewPortSizes : [ "320px", "480px", "540px", "600px", "768px",
  5. "960px", "1024px", "1280px" ],
  6. backgroundColor : "444",
  7. fontColor : "FFF",
  8. postid : 0
  9. };
  10. c = a.extend({}, a.jResize.defaults, c);
  11. var g = '<div class="viewports" style="position:fixed;top:0;left:0;right:0;overflow:auto;z-index:9999;background:#'
  12. + c.backgroundColor
  13. + ";color:#"
  14. + c.fontColor
  15. + ';box-shadow:0 1px 0 #FFFFFF inset, 0 -1px 0 #FFFFFF inset, 0 3px 0 #EEEEEE inset, 0 -3px 0 #EEEEEE inset, 0 0 5px rgba(0, 0, 0, 0.1);"><ul class="viewlist"></ul><div style="clear:both;"></div></div>';
  16. var e = c.viewPortSizes;
  17. var d = "display:inline-block;cursor:pointer;font-size:12px;line-height:12px;text-align:center;width:5%;border-right:1px solid #EEEEEE;padding:10px 5px;";
  18. var f = '<a href="http://www.gbtags.com" style="color:#'
  19. + c.fontColor
  20. + ';text-decoration:underline;"><div class="gbtags-preview-logo" style="float:right;padding:10px 25px;font-size:14px;line-height:12px;">&nbsp;</div></a>';
  21. a("body").wrapInner('<div id="resizer" />');
  22. a("#resizer").before(g);
  23. a.each(e, function(i, h) {
  24. a(".viewlist")
  25. .append(
  26. a('<li class="' + h + '" style="' + d + '">' + h
  27. + "</li>"));
  28. a("." + h + "").click(function() {
  29. a("#resizer").animate({
  30. width : "" + h + ""
  31. }, 300)
  32. })
  33. });
  34. a(".viewlist")
  35. .prepend(
  36. '<li class="reset" style="'
  37. + d + '">ȱʡ</li>', f);
  38. var b = a(".viewlist").outerHeight();
  39. a(".viewports").hide().slideDown("300");
  40. a("#resizer").css({
  41. margin : "0 auto"
  42. }).animate({
  43. marginTop : b
  44. });
  45. a(".reset").click(function() {
  46. a("#resizer").css({
  47. width : "auto"
  48. })
  49. })
  50. }
  51. })(jQuery);