לוגו אתר Fresh          
 
 
  אפשרות תפריט  ראשי     אפשרות תפריט  צ'אט     אפשרות תפריט  מבזקים     אפשרות תפריט  צור קשר     חץ שמאלה ‎print ‎"Hello World!"; if‎ ‎not rules.‎know ‎then rules.‎read(); חץ ימינה  

לך אחורה   לובי הפורומים > מחשבים > תכנות ובניית אתרים
שמור לעצמך קישור לדף זה באתרי שמירת קישורים חברתיים
תגובה
 
כלי אשכול חפש באשכול זה



  #1  
ישן 10-07-2007, 00:08
  allonm allonm אינו מחובר  
 
חבר מתאריך: 09.07.07
הודעות: 5
בעיה עם div אשר מתחבא מאחורי scrolling div

אז כך הבעיה... נורא אשמח לקבל המצלה לפתירתה!!

יש div שמופיע כאשר לוחצים על הקישור. ה- div מוחבה מאחורי הגלילה של ה- div שבתוכו הוא נמצא.

אני צריך שה- div שמופיע יהיה מעל (לפני) ה- div עם הגלילה.

ניתן לפטור את הבעיה ב IE אם מוציאים את ה - "position:relative;" מה- div הראשון. אך זה לא פותר את הבעיה ב- FF.

הנה כל הקוד מהתחלתו ועד סופו:

קוד:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>hover div bug test</title> </head> <body style="FONT-FAMILY:Arial; color:#000; font-size:10pt;"> <script type="text/javascript"> function toggleHover() { var h = document.getElementById("hover"); var w = document.getElementById("wrapper"); if(h.style.display == "none") { h.style.top = w.clientHeight + 5 + "px"; h.style.display = ""; } else h.style.display = "none"; } </script> <div style="width:150px; height:150px; border:solid 5px #ccc; overflow-y:auto; overflow-x:hidden; padding:10px; margin:10px; z-index:0; position:relative;"> <div id="wrapper" style="float:left; position:relative;"> <a href="javascript:toggleHover()">The Link</a> <div id="hover" style="background-color:#eee; border:solid 2px #000; position:absolute; top:0; left:0; z-index:9999; width:275px; padding:10px; FONT-FAMILY: Arial, Helvetica, Verdana sans; display:none;"> Hover div with a set width and a long string of text. </div> </div> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> </div> <br /><br /><br /><br /><br /> </html>
תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
  #4  
ישן 10-07-2007, 12:09
צלמית המשתמש של fcf
  משתמש זכר fcf fcf אינו מחובר  
 
חבר מתאריך: 17.09.05
הודעות: 6,023
שלח הודעה דרך ICQ אל fcf שלח הודעה דרך MSN אל fcf Facebook profile
איך
בתגובה להודעה מספר 3 שנכתבה על ידי allonm שמתחילה ב "זה כבר נעשה ולא שינה..."

תיקנתי והוספתי גם DRAG לDIV הקופץ שישיה יותר נוח ....

קוד:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>hover div bug test</title> <script type="text/javascript"> /************************************************** * dom-drag.js * 09.25.2001 * www.youngpup.net * Script featured on Dynamic Drive (http://www.dynamicdrive.com) 12.08.2005 ************************************************** * 10.28.2001 - fixed minor bug where events * sometimes fired off the handle, not the root. ************************************************** / var Drag = { obj : null, init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper) { o.onmousedown = Drag.start; o.hmode = bSwapHorzRef ? false : true ; o.vmode = bSwapVertRef ? false : true ; o.root = oRoot && oRoot != null ? oRoot : o ; if (o.hmode && isNaN(parseInt(o.root.style.left ))) o.root.style.left = "0px"; if (o.vmode && isNaN(parseInt(o.root.style.top ))) o.root.style.top = "0px"; if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right = "0px"; if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px"; o.minX = typeof minX != 'undefined' ? minX : null; o.minY = typeof minY != 'undefined' ? minY : null; o.maxX = typeof maxX != 'undefined' ? maxX : null; o.maxY = typeof maxY != 'undefined' ? maxY : null; o.xMapper = fXMapper ? fXMapper : null; o.yMapper = fYMapper ? fYMapper : null; o.root.onDragStart = new Function(); o.root.onDragEnd = new Function(); o.root.onDrag = new Function(); }, start : function(e) { var o = Drag.obj = this; e = Drag.fixE(e); var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); o.root.onDragStart(x, y); o.lastMouseX = e.clientX; o.lastMouseY = e.clientY; if (o.hmode) { if (o.minX != null) o.minMouseX = e.clientX - x + o.minX; if (o.maxX != null) o.maxMouseX = o.minMouseX + o.maxX - o.minX; } else { if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x; if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x; } if (o.vmode) { if (o.minY != null) o.minMouseY = e.clientY - y + o.minY; if (o.maxY != null) o.maxMouseY = o.minMouseY + o.maxY - o.minY; } else { if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y; if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y; } document.onmousemove = Drag.drag; document.onmouseup = Drag.end; return false; }, drag : function(e) { e = Drag.fixE(e); var o = Drag.obj; var ey = e.clientY; var ex = e.clientX; var y = parseInt(o.vmode ? o.root.style.top : o.root.style.bottom); var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right ); var nx, ny; if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX); if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX); if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY); if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY); nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1)); ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1)); if (o.xMapper) nx = o.xMapper(y) else if (o.yMapper) ny = o.yMapper(x) Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px"; Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px"; Drag.obj.lastMouseX = ex; Drag.obj.lastMouseY = ey; Drag.obj.root.onDrag(nx, ny); return false; }, end : function() { document.onmousemove = null; document.onmouseup = null; Drag.obj.root.onDragEnd( parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"])); Drag.obj = null; }, fixE : function(e) { if (typeof e == 'undefined') e = window.event; if (typeof e.layerX == 'undefined') e.layerX = e.offsetX; if (typeof e.layerY == 'undefined') e.layerY = e.offsetY; return e; } }; </script> </head> <body style="FONT-FAMILY:Arial; color:#000; font-size:10pt;"> <script type="text/javascript"> function toggleHover() { var h = document.getElementById("hover"); var w = document.getElementById("wrapper"); if(h.style.display == "none") { h.style.top = w.clientHeight + 5 + "px"; h.style.display = ""; } else h.style.display = "none"; } </script> <div id="hover" style="cursor: pointer;background-color:#eee; border:solid 2px #000; position:absolute; top:550px; left:20px; z-index:999; width:275px; padding:10px; FONT-FAMILY: Arial, Helvetica, Verdana sans; display:none;"> Hover div with a set width and a long string of text. </div> <script type="text/javascript"> Drag.init(document.getElementById("hover")); </script> <div style="width:150px; height:150px; border:solid 5px #ccc; overflow-y:auto; overflow-x:hidden; padding:10px; margin:10px; z-index:0; position:absolute;"> <div id="wrapper" style="float:left; position:relative;"> <a href="javascript:toggleHover()">The Link</a> </div> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> </div> <br /><br /><br /><br /><br /> </html>


הסקריפט של הגרירה הוא של DynamicDrive
http://www.dynamicdrive.com/dynamicindex11/domdrag/

אתה יכול להכניס אותו לקובץ JS על מנת שהקוד יהיה יותר קצר ונוח ...
_____________________________________
תמונה שהועלתה על ידי גולש באתר ולכן אין אנו יכולים לדעת מה היא מכילה
תמונה שהועלתה על ידי גולש באתר ולכן אין אנו יכולים לדעת מה היא מכילה

תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
  #9  
ישן 10-07-2007, 19:01
  DCD DCD אינו מחובר  
 
חבר מתאריך: 17.05.05
הודעות: 7,321
בתגובה להודעה מספר 8 שנכתבה על ידי allonm שמתחילה ב "כן - זה כבר חלק מהקוד. בציר..."

אני לא מבין מה הבעיה להשאיר את ה-DIV בחוץ? בכל מקרה יש לו ערך display: none וגם רואים אותו רק בקוד JS כשאתה קובע לו את המיקום.


קוד:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>hover div bug test</title> </head> <body style="FONT-FAMILY:Arial; color:#000; font-size:10pt;"> <script type="text/javascript"> function findPos(obj) { if (obj.offsetParent) { curleft = obj.offsetLeft; curtop = obj.offsetTop; while (obj = obj.offsetParent) { curleft += obj.offsetLeft; curtop += obj.offsetTop; } return [curleft,curtop]; } else return [(obj.x || 0), (obj.y || 0)]; } function toggleHover() { var h = document.getElementById("hover"); var w = document.getElementById("wrapper"); if(h.style.display == "none") { h.style.top = findPos(w)[1] + 30 + "px"; h.style.left = findPos(w)[0] + 10 + "px"; h.style.display = "block"; } else h.style.display = "none"; } </script> <div style="width:150px; height:150px; border:solid 5px #ccc; overflow-y:auto; overflow-x:hidden; padding:10px; margin:10px; z-index:0; position:static;"> <div id="wrapper" style="float:left; position:relative;"> <a href="javascript:toggleHover()">The Link</a> </div> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> </div> <div id="hover" style="background-color:#eee; border:solid 2px #000; position:absolute; top:0; left:0; z-index:1000; width:275px; padding:10px; font-family: Arial, Helvetica, Verdana sans; display:none;"> Hover div with a set width and a long string of text. </div> <br /><br /><br /><br /><br /> </html>
תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
  #11  
ישן 10-07-2007, 19:17
  DCD DCD אינו מחובר  
 
חבר מתאריך: 17.05.05
הודעות: 7,321
בתגובה להודעה מספר 10 שנכתבה על ידי allonm שמתחילה ב "באתר שאני בונה, זה פשוט חייב..."

ציטוט:
באתר שאני בונה, זה פשוט חייב לאישאר בתוך ה- wrapper ובתוך הגלילה.


זה הדבר היחידי שחייב להיות?
ציין את כל הדברים שחייב שישארו כמו שהם.

מצאתי את הפיתרון הבא:
קוד:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>hover div bug test</title> </head> <body style="FONT-FAMILY:Arial; color:#000; font-size:10pt;"> <script type="text/javascript"> function toggleHover() { var h = document.getElementById("hover"); var w = document.getElementById("wrapper"); if(h.style.display == "none") { h.style.top = w.clientHeight + 5 + "px"; h.style.display = ""; } else h.style.display = "none"; } </script> <div style="width:150px; height:100px; border:solid 5px #ccc; overflow-y:auto; overflow-x:hidden; padding:10px; margin:10px; z-index:0; position:static; visibility:visible; display:table;"> <div id="wrapper" style="float:left; position:relative;"> <a href="javascript:toggleHover()">The Link</a> <div id="hover" style=" background-color:#eee; border:solid 2px #000; position:absolute; top:0; left:0; z-index:9999; width:275px; padding:10px; FONT-FAMILY: Arial, Helvetica, Verdana sans; display:none;"> Hover div with a set width and a long string of text. </div> </div> <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> </div> <br /><br /><br /><br /><br /> </html>

שגורם ל-DIV הכללי display:table
ובצורה הזאת ה-DIV הפנימי מוצג טוב. בדוק את זה.

יש גם דרכים אחרות אני משער אבל קודם תכתוב לי מה חייב שישאר כמו שהוא עכשיו.
תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
תגובה

כלי אשכול חפש באשכול זה
חפש באשכול זה:

חיפוש מתקדם
מצבי תצוגה דרג אשכול זה
דרג אשכול זה:

מזער את תיבת המידע אפשרויות משלוח הודעות
אתה לא יכול לפתוח אשכולות חדשים
אתה לא יכול להגיב לאשכולות
אתה לא יכול לצרף קבצים
אתה לא יכול לערוך את ההודעות שלך

קוד vB פעיל
קוד [IMG] פעיל
קוד HTML כבוי
מעבר לפורום



כל הזמנים המוצגים בדף זה הם לפי איזור זמן GMT +2. השעה כעת היא 01:10

הדף נוצר ב 0.05 שניות עם 11 שאילתות

הפורום מבוסס על vBulletin, גירסא 3.0.6
כל הזכויות לתוכנת הפורומים שמורות © 2026 - 2000 לחברת Jelsoft Enterprises.
כל הזכויות שמורות ל Fresh.co.il ©

צור קשר | תקנון האתר