Photos in Shadowbox javascript

  • ArtphotoasiA
  • Graduate
  • Graduate
  • User avatar
  • Posts: 204
  • Loc: Italy

Post 3+ Months Ago

Hi there, nice to be part of the forum, and sorry for my English, I will try my best but is not my mother tongue.

With bigger monitors available on the market the gap between 1024x768px and 1920x1200px is now really huge so I need to manage a photography website and to display photos as big as possible with all kind of monitors.
Static images with fix dimensions simply do not work anymore. I was a user of lightbox javascript, I loved it.

Looking for something similar I just found out yesterday shadowbox a javascript that actually improve a lot lightbox... with one nice features (not the only one of course) the use of big photos that will be automatically resized to fit the screen whatever resolution the user's screen is.

I found shadowbox javascript quite easy to install ( great thing the compatibility with rel="lightbox[texttext]" )

Regretfully was not easy to be managed and to be modified.

I spent several hours to create my first page model using shadowbox

But now I'm really satisfied.
I have noted a big confusion in forums regarding some issues and I will try now to write what I have noted and solved: (i hope will help :D )



(1) the script works perfectly with ALSO XHTML doctype




(2) the script works with IE8 IE7 IE6 but be CAREFULL to the features settings in the init line:


Code: [ Select ]
========================================================
<script type="text/javascript" src="../shadowbox/shadowbox.js"></script>
<script type="text/javascript">
Shadowbox.init({
  handleOversize:   "resize"
});
</script>
========================================================
  1. ========================================================
  2. <script type="text/javascript" src="../shadowbox/shadowbox.js"></script>
  3. <script type="text/javascript">
  4. Shadowbox.init({
  5.   handleOversize:   "resize"
  6. });
  7. </script>
  8. ========================================================



Just one small mistake like: handleOversize: "resize", just a comma can cause a script error but it works anyway with all browser also IE8 but will not work with IE7 IE6 so note that, just in case.



(3) I have noted no problem in Chrome, Firefox, Opera, Safari at least the last releases.


(4) regarding the TITLE AND CAPTION issue I have to say (after hours of test) that the author of the script probably is right, it is not possible to manage in a good way the resizing of the boxes without knowing BEFORE the height of the title and so basically we are forced to use a fix height. More is the height more line of text will be displayed.

So my suggestion is: decide how many lines you may need for title or description and fix the height of the box accordingly to font px size, and line height.

I have done that for a 10px font so I can have 3/4 lines (quite enough)

Code: [ Select ]
========================================================
#sb-title,#sb-title-inner{
display:block;
height:36px;
}
=======================================================
  1. ========================================================
  2. #sb-title,#sb-title-inner{
  3. display:block;
  4. height:36px;
  5. }
  6. =======================================================




- 4a
If you take out from CSS the height of the title it works (but not very well) for Chrome, Firefox, Opera, Safari.
A padding-bottom will solve the last line cut issue. This solution does not work with IE whatever version. IE require anyway fixing a height otherwise will not display more then text lines.

Code: [ Select ]
========================================================
#sb-title,#sb-title-inner{
display:block;
padding-bottom:20px;
}
========================================================
  1. ========================================================
  2. #sb-title,#sb-title-inner{
  3. display:block;
  4. padding-bottom:20px;
  5. }
  6. ========================================================




- 4b
I have noted that is much better to have the text below the photos so who is interested in that must change the file shadowbox.js and find in there the markup values, then must change the position of a couple of div

Code: [ Select ]
<div id="sb-title"><div id="sb-title-inner"></div></div>

 like I have done here: BE CAREFULL DO NOT CHANGE ANY SPACE IN THE CODE OR WILL NOT WORK... USE THIS CODE STARTING FROM

<div style="clear:both">



'<div style="clear:both"></div></div></div><div id="sb-title"><div id="sb-title-inner"></div></div></div></div>'



In this way the text will be under the photos.

=====================================================================
  1. <div id="sb-title"><div id="sb-title-inner"></div></div>
  2.  like I have done here: BE CAREFULL DO NOT CHANGE ANY SPACE IN THE CODE OR WILL NOT WORK... USE THIS CODE STARTING FROM
  3. <div style="clear:both">
  4. '<div style="clear:both"></div></div></div><div id="sb-title"><div id="sb-title-inner"></div></div></div></div>'
  5. In this way the text will be under the photos.
  6. =====================================================================




Finally I have to say that this script is absolutely a great thing! after few hours of work i have re-created a lightbox feeling with shadowbox.css modification.
I will change now all my website portfolios pages using shadowbox javascript.
I would like to post a link to sample page done yesterday but is not allowed in the forum :(



This is part of the CSS I have modified, if someone want to know more just let me know.
Best Regards.
Code: [ Select ]
====================================
FOR THE IMAGE LOADING
====================================

#sb-loading{
position:absolute;
top:0;
width:100%;
height:100%;
display:none;
text-align:center;
padding-top:10px;
}
#sb-body,#sb-loading{
background-color:#FFFFFF;
background-image:url(resources/loading.gif);
background-repeat:no-repeat;
background-position: center;
}





====================================
FOR THE TEXT
====================================

#sb-title,#sb-info{
background-color:#FFFFFF;
position:relative;
margin:0;
padding:0;
overflow:hidden;
}
#sb-title-inner,#sb-info-inner{
background-color:#FFFFFF;
position: relative;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
line-height: 14px;
font-weight: bold;
}
#sb-title,#sb-title-inner{
display:block;
height:36px;
padding-bottom:20px;
}
#sb-title-inner{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
line-height:14px;
font-weight:bold;
color:#666666;
padding:8px;
}







====================================
FOR THE BAR
====================================

#sb-info,#sb-info-inner{
height:20px;
}
#sb-info-inner{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
line-height:14px;
font-weight:bold;
color:#666666;
padding-left: 8px;
}
#sb-nav{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
line-height:14px;
font-weight:bold;
float:right;
height:16px;
padding:2px 0;
width:45%;
}
#sb-nav a{
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
line-height:14px;
font-weight:bold;
display:block;
float:right;
height:16px;
width:16px;
margin-left:3px;
cursor:pointer;
}
#sb-nav-close{
background-image:url(resources/close.png);
background-repeat:no-repeat;
padding-left:10px;
}
#sb-nav-next{
background-image:url(resources/next.png);
background-repeat:no-repeat;
margin-top:-3px;
padding-left:10px;
}
#sb-nav-previous{
background-image:url(resources/previous.png);
background-repeat:no-repeat;
margin-top:-3px;
padding-left:10px;
}
  1. ====================================
  2. FOR THE IMAGE LOADING
  3. ====================================
  4. #sb-loading{
  5. position:absolute;
  6. top:0;
  7. width:100%;
  8. height:100%;
  9. display:none;
  10. text-align:center;
  11. padding-top:10px;
  12. }
  13. #sb-body,#sb-loading{
  14. background-color:#FFFFFF;
  15. background-image:url(resources/loading.gif);
  16. background-repeat:no-repeat;
  17. background-position: center;
  18. }
  19. ====================================
  20. FOR THE TEXT
  21. ====================================
  22. #sb-title,#sb-info{
  23. background-color:#FFFFFF;
  24. position:relative;
  25. margin:0;
  26. padding:0;
  27. overflow:hidden;
  28. }
  29. #sb-title-inner,#sb-info-inner{
  30. background-color:#FFFFFF;
  31. position: relative;
  32. font-family: Verdana, Arial, Helvetica, sans-serif;
  33. font-size: 10px;
  34. line-height: 14px;
  35. font-weight: bold;
  36. }
  37. #sb-title,#sb-title-inner{
  38. display:block;
  39. height:36px;
  40. padding-bottom:20px;
  41. }
  42. #sb-title-inner{
  43. font-family: Verdana, Arial, Helvetica, sans-serif;
  44. font-size: 10px;
  45. line-height:14px;
  46. font-weight:bold;
  47. color:#666666;
  48. padding:8px;
  49. }
  50. ====================================
  51. FOR THE BAR
  52. ====================================
  53. #sb-info,#sb-info-inner{
  54. height:20px;
  55. }
  56. #sb-info-inner{
  57. font-family: Verdana, Arial, Helvetica, sans-serif;
  58. font-size: 10px;
  59. line-height:14px;
  60. font-weight:bold;
  61. color:#666666;
  62. padding-left: 8px;
  63. }
  64. #sb-nav{
  65. font-family: Verdana, Arial, Helvetica, sans-serif;
  66. font-size: 10px;
  67. line-height:14px;
  68. font-weight:bold;
  69. float:right;
  70. height:16px;
  71. padding:2px 0;
  72. width:45%;
  73. }
  74. #sb-nav a{
  75. font-family: Verdana, Arial, Helvetica, sans-serif;
  76. font-size: 10px;
  77. line-height:14px;
  78. font-weight:bold;
  79. display:block;
  80. float:right;
  81. height:16px;
  82. width:16px;
  83. margin-left:3px;
  84. cursor:pointer;
  85. }
  86. #sb-nav-close{
  87. background-image:url(resources/close.png);
  88. background-repeat:no-repeat;
  89. padding-left:10px;
  90. }
  91. #sb-nav-next{
  92. background-image:url(resources/next.png);
  93. background-repeat:no-repeat;
  94. margin-top:-3px;
  95. padding-left:10px;
  96. }
  97. #sb-nav-previous{
  98. background-image:url(resources/previous.png);
  99. background-repeat:no-repeat;
  100. margin-top:-3px;
  101. padding-left:10px;
  102. }
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 81 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.