Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Bug w Chrome przy gradientowym tle i fancyboxie
Forum PHP.pl > Forum > Po stronie przeglądarki > CSS
tom1988
Witam,
mam problem, który jest spowodowany prawdopodobnie jakimś błędem w chrome, ponieważ w każdej innej przeglądarce wszystko wygląda dobrze.
Otóż mam tło typu gradient:

  1. body {
  2. height: 100%;
  3. background: #242a2d; /* Old browsers */
  4. background: -moz-linear-gradient(top, #242a2d 0%, #394248 100%) no-repeat #394248; /* FF3.6+ */
  5. background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#242a2d), color-stop(100%,#394248)) no-repeat #394248; /* Chrome,Safari4+ */
  6. background: -webkit-linear-gradient(top, #242a2d 0%,#394248 100%) no-repeat #394248; /* Chrome10+,Safari5.1+ */
  7. background: -o-linear-gradient(top, #242a2d 0%,#394248 100%) no-repeat #394248; /* Opera 11.10+ */
  8. background: -ms-linear-gradient(top, #242a2d 0%,#394248 100%) no-repeat #394248; /* IE10+ */
  9. background: linear-gradient(to bottom, #242a2d 0%,#394248 100%) no-repeat #394248; /* W3C */
  10. filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#242a2d', endColorstr='#394248',GradientType=0 ) no-repeat #394248; /* IE6-9 */
  11. margin-top: 0px;
  12. margin-left: 0px;
  13. margin-right: 0px;
  14. margin-bottom: 0px;
  15. }


Gradient na każdej podstronie wygląda bardzo dobrze poza galerią ze skryptem fancybox, na której nagle zamiast gradientu, na wysokości zdjęć pojawiają się dziwne schodki:
www.tinyurl.com/c8eazsh
A tutaj zrzut gdyby ktoś nie miał przeglądarki chrome: http://s14.postimage.org/adjfchsdd/Clipboard01.jpg
Co ciekawe, po naciśnięciu klawisza f11 w chrome błąd znika, podobnie jak i przy kliknięciu na dowolne zdjęcie.

Kod poprzez, który wrzucam zdjęcia:
  1. <a class="fancybox-effects-d" href="galeria/1.jpg" data-fancybox-group="gallery" title="galeria"><img src="galeria/1_small.jpg" alt="" /></a>


Część od fancyboxa, którą mam w head:
  1. <script type="text/javascript" src="fancybox/jquery.fancybox.js?v=2.1.4"></script>
  2. <link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox.css?v=2.1.4" media="screen" />
  3. <link rel="stylesheet" type="text/css" href="fancybox/helpers/jquery.fancybox-buttons.css?v=1.0.5" />
  4. <script type="text/javascript" src="fancybox/helpers/jquery.fancybox-buttons.js?v=1.0.5"></script>
  5. <link rel="stylesheet" type="text/css" href="fancybox/helpers/jquery.fancybox-thumbs.css?v=1.0.7" />
  6. <script type="text/javascript" src="fancybox/helpers/jquery.fancybox-thumbs.js?v=1.0.7"></script>
  7. <script type="text/javascript">
  8. $(document).ready(function() {
  9. /*
  10. * Simple image gallery. Uses default settings
  11. */
  12.  
  13. $('.fancybox').fancybox();
  14.  
  15. /*
  16. * Different effects
  17. */
  18.  
  19. // Change title type, overlay closing speed
  20. $(".fancybox-effects-a").fancybox({
  21. helpers: {
  22. title : {
  23. type : 'outside'
  24. },
  25. overlay : {
  26. speedOut : 0
  27. }
  28. }
  29. });
  30.  
  31. // Disable opening and closing animations, change title type
  32. $(".fancybox-effects-b").fancybox({
  33. openEffect : 'true',
  34. closeEffect : 'none',
  35.  
  36. helpers : {
  37. title : {
  38. type : 'over'
  39. }
  40. }
  41. });
  42.  
  43. // Set custom style, close if clicked, change title type and overlay color
  44. $(".fancybox-effects-c").fancybox({
  45. wrapCSS : 'fancybox-custom',
  46. closeClick : true,
  47.  
  48. openEffect : 'true',
  49.  
  50. helpers : {
  51. title : {
  52. type : 'inside'
  53. },
  54. overlay : {
  55. css : {
  56. 'background' : 'rgba(0,0,0,0.0)'
  57. }
  58. }
  59. }
  60. });
  61.  
  62. // Remove padding, set opening and closing animations, close if clicked and disable overlay
  63. $(".fancybox-effects-d").fancybox({
  64. padding: 0,
  65.  
  66. openEffect : 'elastic',
  67. openSpeed : 150,
  68.  
  69. closeEffect : 'elastic',
  70. closeSpeed : 150,
  71.  
  72. closeClick : true,
  73.  
  74. helpers : {
  75. overlay : true
  76. }
  77. });
  78.  
  79. /*
  80. * Button helper. Disable animations, hide close button, change title type and content
  81. */
  82.  
  83. $('.fancybox-buttons').fancybox({
  84. openEffect : 'none',
  85. closeEffect : 'none',
  86.  
  87. prevEffect : 'none',
  88. nextEffect : 'none',
  89.  
  90. closeBtn : false,
  91.  
  92. helpers : {
  93. title : {
  94. type : 'inside'
  95. },
  96. buttons : {}
  97. },
  98.  
  99. afterLoad : function() {
  100. this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
  101. }
  102. });
  103.  
  104.  
  105. /*
  106. * Thumbnail helper. Disable animations, hide close button, arrows and slide to next gallery item if clicked
  107. */
  108.  
  109. $('.fancybox-thumbs').fancybox({
  110. prevEffect : 'none',
  111. nextEffect : 'none',
  112.  
  113. closeBtn : false,
  114. arrows : false,
  115. nextClick : true,
  116.  
  117. helpers : {
  118. thumbs : {
  119. width : 50,
  120. height : 50
  121. }
  122. }
  123. });
  124.  
  125. /*
  126. * Media helper. Group items, disable animations, hide arrows, enable media and button helpers.
  127. */
  128. $('.fancybox-media')
  129. .attr('rel', 'media-gallery')
  130. .fancybox({
  131. openEffect : 'none',
  132. closeEffect : 'none',
  133. prevEffect : 'none',
  134. nextEffect : 'none',
  135.  
  136. arrows : false,
  137. helpers : {
  138. media : {},
  139. buttons : {}
  140. }
  141. });
  142.  
  143. /*
  144. * Open manually
  145. */
  146.  
  147. $("#fancybox-manual-a").click(function() {
  148. $.fancybox.open('1_b.jpg');
  149. });
  150.  
  151. $("#fancybox-manual-b").click(function() {
  152. $.fancybox.open({
  153. href : 'iframe.html',
  154. type : 'iframe',
  155. padding : 5
  156. });
  157. });
  158.  
  159. $("#fancybox-manual-c").click(function() {
  160. $.fancybox.open([
  161. {
  162. href : '1_b.jpg',
  163. title : 'My title'
  164. }, {
  165. href : '2_b.jpg',
  166. title : '2nd title'
  167. }, {
  168. href : '3_b.jpg'
  169. }
  170. ], {
  171. helpers : {
  172. thumbs : {
  173. width: 75,
  174. height: 50
  175. }
  176. }
  177. });
  178. });
  179.  
  180.  
  181. });
  182. </script>

Próbowałem usunąć pliki css od fancyboxa, ale błąd dalej występował, dopiero po usunięciu z head plików *.js błąd znikł, ale też oczywiście fancybox przestał działać. To są dwa pliki jquery.fancybox-thumbs i jquery.fancybox-media. http://wklej.se/fa30 i http://wklej.se/bac3
Próbowałem rozwiązać problem poprzez zmianę atrybutów w plikach css fancyboxa z np absolute na fixed, ale w niczym to nie pomogło.

Czy ktoś ma jakiś pomysł jak ten problem rozwiązać?
!*!
Kod
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#242a2d), color-stop(100%,#394248)) no-repeat #394248; /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #242a2d 0%,#394248 100%) no-repeat #394248; /* Chrome10+,Safari5.1+ */


To nie robi kolizji?
Przerzuć te pliki JS na koniec dokumentu, lub uruchom FB dopiero po załadowaniu całej strony.
tom1988
Wywaliłem linijkę
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#242a2d), color-stop(100%,#394248)) no-repeat #394248; /* Chrome,Safari4+ */

i od tej pory działa dobrze, wielkie dzięki za pomoc!
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.