Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JS] informacje o zdjeciu po najechaniu na nie
Forum PHP.pl > Forum > Przedszkole
szafran86
Witam

Mam taki problem:

Na swojej stronie umieściłem obrazki które są oceniane, każdemu obrazkowi przypisana jest średnia ocena.

Chciałbym aby po najechaniu na obrazek pojawiło się coś takiego jak Title przy odnośnikach ze średnią oceną tego zdjęcia.

Mógłbym wykorzystać title ale trochę trzeba czekać aż się pojawi a chodzi mi o to żeby średnia ocena pojawiała sie od razu po najechaniu na obraz.

Proszę o pomoc, może jakiś kodzik w JS lub chociaż wskazówki.
wieprzucpp
poniższy kod może ci pomoże ;]

plik gpe.js
  1. /*
  2. Graculini's Popup Engine - GPE v1.0
  3. CopyrightŠ Gracjan Lech 2003.
  4. Contact me: gracjan.lech@poczta.fm
  5. This notice must remain untouched at all times.
  6.  
  7. */
  8.  
  9. function displayConfig() {
  10. //KONFIGURACJA START
  11.  
  12. //Odstęp popup'a od kursora w poziomie
  13. if ((popupOffsetX=getValue("popupOffsetX"))==NA)
  14. popupOffsetX=20
  15. //Odstęp popup'a od kursora w pionie
  16. if ((popupOffsetY=getValue("popupOffsetY"))==NA)
  17. popupOffsetY=10
  18. //Położenie popup'a względem myszki
  19. if ((popupAlign=getValue("popupAlign"))==NA)
  20. popupAlign="right" //Inne opcje - left, center
  21. //Długość popup'a
  22. if ((popupWidth=getValue("popupWidth"))==NA)
  23. popupWidth=160
  24. //Szerokość obramowania całego popup'a
  25. if ((popupBorderWidth=getValue("popupBorderWidth"))==NA)
  26. popupBorderWidth="1px"
  27. //Kolor obramowania popup'a
  28. if ((popupBorderColor=getValue("popupBorderColor"))==NA)
  29. popupBorderColor="#333399"
  30. //Styl obramowania popup'a (dotted, double...)
  31. if ((popupBorderStyle=getValue("popupBorderStyle"))==NA)
  32. popupBorderStyle="solid"
  33. //Domyślna przeźroczystość popup'a
  34. if ((popupOpacity=getValue("popupOpacity"))==NA)
  35. popupOpacity=100
  36. //Kolor czcionki nagłówka
  37. if ((captionColor=getValue("captionColor"))==NA)
  38. captionColor="#ffffff"
  39. //Styl czcionki nagłówka
  40. if ((captionFontStyle=getValue("captionFontStyle"))==NA)
  41. captionFontStyle="normal"
  42. //Pogrubienie czcionki nagłówka
  43. if ((captionFontWeight=getValue("captionFontWeight"))==NA)
  44. captionFontWeight="bold"
  45. //Wielkość czcionki nagłówka
  46. if ((captionFontSize=getValue("captionFontSize"))==NA)
  47. captionFontSize="9px"
  48. //Czcionka nagłówka
  49. if ((captionFontFamily=getValue("captionFontFamily"))==NA)
  50. captionFontFamily="Verdana, sans-serif"
  51. //Wypełnienie ogólne
  52. if ((captionPadding=getValue("captionPadding"))==NA)
  53. captionPadding="0px";
  54. //Kolor tła nagłówka
  55. if ((captionBackgroundColor=getValue("captionBackgroundColor"))==NA)
  56. captionBackgroundColor=popupBorderColor
  57. //Tło nagłówka
  58. if ((captionBackgroundImage=getValue("captionBackgroundImage"))==NA)
  59. captionBackgroundImage=""
  60. //Dodatki do tła
  61. if ((captionBackgroundImageProperties=getValue("captionBackgroundImageProperties"))==NA)
  62. captionBackgroundImageProperties=""
  63. //Kolor czcionki tekstu
  64. if ((textColor=getValue("textColor"))==NA)
  65. textColor="#000000"
  66. //Styl czcionki tekstu
  67. if ((textFontStyle=getValue("textFontStyle"))==NA)
  68. textFontStyle="normal"
  69. //Pogrubienie czcionki tekstu
  70. if ((textFontWeight=getValue("textFontWeight"))==NA)
  71. textFontWeight="normal"
  72. //Wielkość czcionki tekstu
  73. if ((textFontSize=getValue("textFontSize"))==NA)
  74. textFontSize="10px"
  75. //Czcionka tekstu
  76. if ((textFontFamily=getValue("textFontFamily"))==NA)
  77. textFontFamily="Tahoma"
  78. //Wypełnienie ogólne
  79. if ((textPadding=getValue("textPadding"))==NA)
  80. textPadding="2px";
  81. //Kolor tła tekstu
  82. if ((textBackgroundColor=getValue("textBackgroundColor"))==NA)
  83. textBackgroundColor="#ccccff"
  84. //Tło tekstu
  85. if ((textBackgroundImage=getValue("textBackgroundImage"))==NA)
  86. textBackgroundImage=""
  87. //Dodatki do tła
  88. if ((textBackgroundImageProperties=getValue("textBackgroundImageProperties"))==NA)
  89. textBackgroundImageProperties=""
  90. //fadeIn
  91. if ((fadeIn=params.indexOf("fadeIn"))!=-1)
  92. fadeIn=true
  93. //Domyślny czas fadeIn
  94. if (fadeIn && ((fadeInTime=getValue("fadeInTime"))==NA))
  95. fadeInTime=1
  96. //fadeOut
  97. if ((fadeOut=params.indexOf("fadeOut"))!=-1)
  98. fadeOut=true
  99. //Domyślny czas fadeOut
  100. if (fadeOut && ((fadeOutTime=getValue("fadeOutTime"))==NA))
  101. fadeOutTime=1
  102.  
  103. //DODATKOWE SZATY
  104.  
  105. layout[1]="textBackgroundColor: #ffffe1; popupBorderColor: #000000; textFontFamily: verdana; textFontSize: 11px;"
  106. layout[2]="textFontStyle: italic;"
  107.  
  108. //KONFIGURACJA KONIEC
  109. }
  110.  
  111. document.write("<div id=\"popupDiv\" style=\"position: absolute; display: none; z-index: 1000; filter: alpha(opacity=100); -moz-opacity: 1;\">GPE v1.1 - popup engine</div>")
  112. popup=document.getElementById("popupDiv")
  113. OP=NS=IE=false
  114. if (navigator.userAgent.indexOf("Opera")!=-1) OP=true
  115. else if (navigator.appName=="Netscape") NS=true
  116. else if (navigator.appName=="Microsoft Internet Explorer") IE=true
  117.  
  118. function gpe(arguments) {
  119. fadingIn=false
  120. fadeOut=false
  121. params=arguments
  122. layout=new Array()
  123. captionClass=getValue("captionClass")
  124. caption=getValue("caption")
  125. textClass=getValue("textClass")
  126. text=getValue("text")
  127. popupLayout=getValue("popupLayout")
  128. if (popupLayout!=null) params+=grabLay()
  129. NA=null
  130. displayConfig()
  131. if (popupBorderColor==NA && captionBackgroundColor!=NA) popupBorderColor=captionBackgroundColor
  132. po=eval(popupOpacity)
  133. if (NS) NSpo=(po/100)
  134. if (textBackgroundImage!=null) textBackgroundImage="url('"+textBackgroundImage+"') "+textBackgroundImageProperties+""
  135. if (captionBackgroundImage!=null) captionBackgroundImage="url('"+captionBackgroundImage+"') "+captionBackgroundImageProperties+""
  136. popupContent="<table cellpadding=0 cellspacing=0 style=\"width: "+popupWidth+"; border: "+popupBorderWidth+" "+popupBorderStyle+" "+popupBorderColor+";\">"
  137. if (caption!=NA) {
  138. popupContent+="<tr><td "
  139. if (captionClass==null) popupContent+="style=\"color: "+captionColor+"; font: "+captionFontStyle+" "+captionFontWeight+" "+captionFontSize+" "+captionFontFamily+"; padding: "+captionPadding+"; background: "+captionBackgroundColor+" "+captionBackgroundImage+";\""
  140. else popupContent+="class=\""+captionClass+"\""
  141. popupContent+=">"+caption+"</td></tr>"
  142. }
  143. popupContent+="<tr><td "
  144. if (textClass==null) popupContent+="style=\"color: "+textColor+"; font: "+textFontStyle+" "+textFontWeight+" "+textFontSize+" "+textFontFamily+"; padding: "+textPadding+"; background: "+textBackgroundColor+" "+textBackgroundImage+";\""
  145. else popupContent+="class=\""+textClass+"\""
  146. popupContent+=">"+text+"</td></tr></table>"
  147. if (NS) {
  148. content=document.createRange();
  149. content.setStartBefore(popup);
  150. content=content.createContextualFragment(popupContent);
  151. with (popup) {
  152. if (hasChildNodes()) removeChild(lastChild)
  153. appendChild(content)
  154. }
  155. }
  156. else popup.innerHTML=popupContent
  157. pO(po)
  158. if (IE) gpePos()
  159. document.onmousemove=function gpePos(evt) {
  160. if (NS) {
  161. coordX=evt.pageX
  162. coordY=evt.pageY
  163. winWidth=innerWidth
  164. }
  165. else {
  166. coordX=event.clientX+document.body.scrollLeft
  167. coordY=event.clientY+document.body.scrollTop
  168. winWidth=document.body.clientWidth
  169. }
  170. switch (popupAlign) {
  171. case "left" :
  172. if (coordX-popupWidth-popupOffsetX<0) coordX=popupWidth+popupOffsetX
  173. coordX-=popupWidth+(popupOffsetX*2)
  174. break
  175. case "center" :
  176. if (coordX+popupWidth/2>winWidth) {coordX=winWidth-popupWidth/2; popupOffsetX=0}
  177. if (coordX-popupWidth/2<0) {coordX=popupWidth/2; popupOffsetX=0}
  178. coordX-=popupWidth/2+popupOffsetX
  179. break
  180. case "right" :
  181. if (coordX+popupWidth+popupOffsetX>winWidth) coordX=winWidth-popupWidth-popupOffsetX
  182. }
  183. popup.style.left=coordX+popupOffsetX
  184. popup.style.top=coordY+popupOffsetY
  185. }
  186. popup.style.display="block"
  187. if (fadeIn==true) {
  188. pO(0)
  189. fade(1)
  190. }
  191. popup.style.display="block"
  192. document.onmouseout=function() {
  193. if (fadeOut==true) {
  194. if (fadeIn) fadeIn=false
  195. else pO(po)
  196. fade(2)
  197. }
  198. else popup.style.display="none"
  199. }
  200. }
  201. function getValue(keyWord) {
  202. with (params) {
  203. if (indexOf(keyWord+":")==-1) return
  204. keyInd=lastIndexOf(keyWord+":")
  205. value=substring(keyInd+(keyWord.length+1),indexOf(";",keyInd))
  206. }
  207. while (value.indexOf("|:|")!=-1) {
  208. with (value) {
  209. value=substring(0,indexOf("|:|"))+";"+substring(indexOf("|:|")+3)
  210. }
  211. }
  212. while (value.indexOf(" ")!=-1 && keyWord!="text" && keyWord!="caption") {
  213. with (value) {
  214. value=substring(0,indexOf(" "))+substring(indexOf(" ")+1)
  215. }
  216. }
  217. if (keyWord=="popupOffsetX" || keyWord=="popupOffsetY" || keyWord=="popupWidth") {
  218. value=eval(value)
  219. }
  220. return value
  221. }
  222. function grabLay() {
  223. layParam=displayConfig+""
  224. with (layParam) {
  225. layParam=substring(indexOf("layout["+popupLayout+"]"),indexOf(";\"",indexOf("layout["+popupLayout+"]"))+1)
  226. }
  227. return layParam;
  228. }
  229. function fade(num) {
  230. if (num==1 && fadeIn==true) {
  231. if (pO()!=po) {
  232. pO(2,"+")
  233. fadingIn=setTimeout("fade(1)",fadeInTime)
  234. }
  235. else fadeIn=false
  236. }
  237. if (num==2 && fadeOut==true) {
  238. if (pO()!=0) {
  239. pO(2,"-")
  240. fadingOut=setTimeout("fade(2)",fadeOutTime)
  241. }
  242. else {
  243. fadeOut=false
  244. if (NS==false && IE==false) popup.style.display="none"
  245. }
  246. }
  247. }
  248. function pO(oL,op) {
  249. if (IE) {
  250. with (popup.filters.alpha) {
  251. if (oL==NA) return opacity
  252. if (op==NA) opacity=oL
  253. if (op=="+") {
  254. if (opacity>=po) opacity=po
  255. else opacity+=oL
  256. }
  257. if (op=="-") opacity-=oL
  258. }
  259. }
  260. else if (NS) {
  261. with (popup.style) {
  262. if (oL==NA) return MozOpacity
  263. else oL=(oL/100)
  264. if (op==NA) MozOpacity=oL
  265. if (op=="+") {
  266. if (MozOpacity>=NSpo) MozOpacity=NSpo
  267. else MozOpacity=parseFloat(MozOpacity)+oL
  268. }
  269. if (op=="-") MozOpacity=parseFloat(MozOpacity)-oL
  270. }
  271. }
  272. else return false
  273. }



jakiś plik html
  1. <script src="gpe.js"></script>
  2. </head>
  3. <a href="jakaś_tam_strona" onmouseover="gpe('text:tu wpisz tekst dymka;')">jakaś_tam_strona</a>
  4. </body>
  5. </html>
szafran86
Cytat(wieprzucpp @ 18.10.2007, 21:19:16 ) *
poniższy kod może ci pomoże ;]


Wielkie dzięki - pomógł.
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.