开发者

JQuery Ajax load non local pages with links disabled

Sorry everybody, I'm kind of a newbie to Ajax and Json. Thanks in advance for any help!

Here's the situation: I have a webpage that I created with several links on it. Most of these links point to pages on Wikipedia or various academic sources. When my page loads, I need all links to be enabled. But when I load the wikipedia/academic pages, I need them to load with the links disabled. The point is to present the user with a list of sources so they can fill out a questionnaire, but while filling out the questions I don't want them to get distracted by ot开发者_如何学编程her things on the source pages or be able to navigate more than 1 step away from the questionnaire.


Okay, I did it. You have to open the page in an iframe and cover the iframe with a div that uses a transparent background. This way you can see the iframe, but you can't touch it.

I got the method from here: http://webdeveloper.com/forum/showthread.php?t=182260

And this is my proof:

http://jsfiddle.net/MarkKramer/jwQtd/

Note: Notice how the div doesn't cover the whole Iframe, I have it set just wide enough to cover the iframe, but to still show the scroll bar so you can see the web page and you can scroll up and down it, but you can't click on it.

Here is the source:

<div 
    id="framecover" 
    style="
        position:absolute; 
        width:(same as iframe -30px for the scroll bar); 
        height:(same as iframe);
        top:(use to set over iframe)
        right:(use to set over iframe)
        z-index:(higher than iframe);
        background-color: transparent;" 
        <!--change the bg-color to see where the div is when youre positioning it-->
></div>

<iframe src="_whatever you want_" width="_y_" height="_x_">
    <!--Fallback for older browsers-->
    <p>Your browser does not support iframes.</p>
</iframe>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜