layer.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. showtooltipPhoto = false; //默认提示不显示
  2. /**提示 */
  3. function tooltip(file,type){
  4. //页面层
  5. title = '提示信息';
  6. switch (type) {
  7. case 1:
  8. title="圖形提示";
  9. break;
  10. case 2:
  11. title="文字提示";
  12. break;
  13. default:
  14. title="文字提示";
  15. break;
  16. }
  17. var filename = "img/"+file;
  18. var img = new Image();
  19. img.src = filename;
  20. img.onload = function() {
  21. var html = "<div><img style='width:100%' src='"+filename+"'/> </div>";
  22. var width = window.screen.width;
  23. var imgwidth = img.width;
  24. if(width<imgwidth){
  25. imgwidth = width;
  26. }else{
  27. imgwidth += 20;
  28. }
  29. layer.open({
  30. type: 1,
  31. content: html,
  32. area: [imgwidth+'px', img.height+60+'px'],
  33. title:title,
  34. });
  35. };
  36. }
  37. /**图片提示 */
  38. function tooltipPhoto(){
  39. showtooltipPhoto =!showtooltipPhoto;
  40. if(showtooltipPhoto){
  41. document.getElementById("blank").style.visibility="hidden";
  42. document.getElementById("tooltipPhoto").style.display="inline";
  43. document.getElementById("right-item").style.visibility="hidden";
  44. document.getElementById("left-item").style.visibility="hidden";
  45. }else{
  46. document.getElementById("blank").style.visibility="visible";
  47. document.getElementById("tooltipPhoto").style.display="none";
  48. document.getElementById("right-item").style.visibility="visible";
  49. document.getElementById("left-item").style.visibility="visible";
  50. }
  51. }
  52. /**回答问题 */
  53. function checkAns2(){
  54. if(showtooltipPhoto){
  55. tooltipPhoto();
  56. }
  57. document.getElementById("tooltip1").style.display="none";
  58. document.getElementById("tooltip2").style.display="none";
  59. checkAns(612)
  60. }
  61. /**转图片 */
  62. function rotatePic2(top,bottom,value,direction){
  63. if(showtooltipPhoto){
  64. tooltipPhoto();
  65. }
  66. rotatePic(top,bottom,value,direction)
  67. }
  68. /**回答问题 */
  69. function checkCorrect2(callback){
  70. document.getElementById("checkButton29").style.visibility="hidden";
  71. document.getElementById("tooltip1").style.visibility="hidden";
  72. document.getElementById("tooltip2").style.visibility="hidden";
  73. if(showtooltipPhoto){
  74. tooltipPhoto();
  75. }
  76. callback();
  77. }