2012-04-03 11 views
1

Es gibt zwei Dinge:jQuery-UI-Position nicht, wenn die Scrollbar

  • Oder, einen Ruck
  • Oder habe ich einen Fehler

Ich habe eine Webseite mit einem Iframe.

Ich möchte ein Symbol in der unteren linken Ecke des iframe platzieren. Also dachte ich, ich könnte das mit jquery-ui machen.

hier ist mein Versuch nicht funktioniert:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 
     "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
    <title>test positionLogo</title> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> 
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/redmond/jquery-ui.css" 
      type="text/css" media="screen"/> 
    <style type="text/css"> 
     div.positionLogo { 
      width: 64px; 
      height: 64px; 
      position: absolute; 
      display: block; 
      text-align: center; 
      background: #FFFFFF url(http://qooxdoo.org/_media/stackoverflow.png) no-repeat center; 
     } 
    </style> 
</head> 
<body> 

<h2>Header</h2> 

<iframe id="idIframe" name="idIframe" scrolling="no" height="1600px" width="100%" src="http://www.google.it" 
     frameborder="0"></iframe> 

<div class="positionLogo"></div> 

<script type="text/javascript"> 
    $(document).ready(function() { 
     $(".positionLogo").position({ 
      of:$("#idIframe"), 
      my:"left bottom", 
      at:"left bottom" 
     }); 
    }); 
</script> 

</body> 
</html> 

das Schöne daran ist, dass, wenn Sie die der Option height="1600px"-height="300px"

Das Widget funktioniert iframe Höhe ändern korrekt! : S

Wie ist es möglich? Danke

Antwort

5

Was Sie brauchen, ist Kollisionsoption des Positions-Widget (setzen Sie es auf keine). Der Standardwert ist flip, die automatisch versucht Position einzustellen für Sie (auf sichtbaren Teil einer Seite)

http://jqueryui.com/demos/position/#option-collision

$(document).ready(function() { 
     $(".positionLogo").position({ 
      of:$("#idIframe"), 
      my:"left bottom", 
      at:"left bottom", 
      collision: 'none' 
     }); 
    }); 
+0

Dank you so much! – JellyBelly

Verwandte Themen