Portamento Floating Fixed-Position Plugin

Add-ons
2026-07-21 12:59 6 次浏览 • 0 次下载 37.0KB
Portamento Floating Fixed-Position Plugin

Portamento is a jQuery plugin that adds a floating panel to a web page. The panel moves along with the page as the user scrolls.

Usage

It is easy to use. Just follow the steps below, and you'll have a smoothly sliding panel!

1. Add portamento.js and the jQuery library to your page, just before </body>.

1
2
<script src="portamento.js"></script>
<script src="jquery-1.9.1.min.js"></script>

2. Add the div element you want to float to your HTML and assign it an ID, such as "#sidebar".

1
2
3
<div id="sidebar">
<p>Hello, I'm a sliding panel - unless the viewport </p>
</div>

3. Apply the plugin to the element you want in your JavaScript:

1
2
3
<script>
$('#sidebar').portamento({disableWorkaround: true});
</script>

4. Add the styles to your CSS.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#wrapper {
overflow:hidden;
}
#content {
width:486px;
margin-right:10px;
float:left;
min-height:1200px;
}
#sidebar {
width:284px;
padding:10px;
background:#eee;
float:right;
height:400px;
}
#portamento_container {
float:right;
position:relative;
}
#portamento_container #sidebar {
float:none;
position:absolute;
}
#portamento_container #sidebar.fixed {
position:fixed;
}
星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare