English 中文(简体)
qTip2 within an iFrame
原标题:

I am using jQuery qTip2 within an iframe but since I am restricted to the size of the iframe width and height, is there anyway I could have the content actually appear on top of the iframe, i.e. within the parent window of the iframe and not within the actual iframe itself?

In this way, I am not restricted within the iframe size.

This is the current code that I am using as part of the iframe:

$(document).ready(function() {
   $( img[title] ).qtip({
         content: {
            text: false, // Use each elements title attribute
            title: {
              text:  Error ,
              button:  Close 
            }
         },
         hide: {
           event: false
         },
         style: {
            classes:  ui-tooltip-dark ui-tooltip-rounded ,
            height: 5,
            width: 500
         },
         position: {
            my:  bottom right ,
            at:  top left 
         }
   });
});
问题回答

Craig posted a link in response to your same post in the qTip2 forums which answers your question:

http://craigsworks.com/projects/forums/thread-solved-qtip-in-iframe-and-mouse-tracking

From reading the discussion, the short answer is that you ll have to initialize the qTips from the parent document, which jQuery makes easy. The hard part of that is that the you ll have to deal with the same origin policy of Javascript. In other words, both documents must come from the same domain. If not, you re out of luck.

One other caveat is that you ll have to manually adjust the qTip positioning since you re initializing from the parent document.

Here s a working example:

http://fiddle.jshell.net/4QDcz/1/

$(document).ready(function () {

    $( #theFrame ).contents().find( .selector ).qtip({
        position: {
            adjust: {
                x: $( #theFrame ).offset().left,
                y: $( #theFrame ).offset().top
            }
        }
     });

});

I am wondering if setting the view port will solve your problem. something like this:

position: {
             my:  top center ,  // Position my top left...
             at:  bottom center , // at the bottom right of...
             viewport: $(window)
          },




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签