如何在iframe中添加平移工具?

时间:2014-01-24 05:20:07

标签: javascript jquery css pan

我只想在“iframe”中添加一个平移工具, 我试过this demo 但我无法在iframe中制作平移工具。 任何人都可以对此提出任何建议。

我的HTML是

<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Grab-to-pan.js demo</title>
<link rel="stylesheet" href="grab-to-pan.css" type="text/css">
<style>
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}
.scrollable {
    overflow: auto;
    width: 100%;
    height: 100%;
    max-width: 300px;
    max-height: 300px;
    background-color: #EEE;
}
.filler {
    width: 200%;
    font-size: 100px; /* I don't want to type a huge wall of Lorem ipsum */
}
</style>
</head>
<body>
<label><input type="checkbox" id="activate-g2p" checked> Activate Grab to Pan</label>
<div class="scrollable" id="scrollable-container">
    <div class="filler">
        Grab to pan - Grab this section with your mouse, and move your mouse around to pan the content.
    </div>
</div>
<script src="grab-to-pan.js"></script>
<script>
document.getElementById('activate-g2p').onchange = function() {
    if (this.checked) g2p.activate();
    else g2p.deactivate();
};

var scrollableContainer = document.getElementById('scrollable-container');
var g2p = new GrabToPan({
    element: scrollableContainer,         // required
    onActiveChanged: function(isActive) { // optional
        if (window.console) { // IE doesn't define console unless the devtools are open
            console.log('Grab-to-pan is ' + (isActive ? 'activated' : 'deactivated'));
        }
    }
});
g2p.activate();

</script>
</body>
</html>

这里我想添加一个iframe ex:www.w3schools.com 在这个链接下我需要泛工具(手)。

谢谢

0 个答案:

没有答案