HTML
<div id="f">
I'm going to follow you only so far...
</div>
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
JS
var windw = this;
$.fn.followTo = function(pos) {
var $this = this,
$window = $(windw);
$window.scroll(function(e) {
if ($window.scrollTop() > pos) {
$this.css({
position: 'absolute',
top: pos
});
} else {
$this.css({
position: 'fixed',
top: 0
});
}
});
};
$('#f').followTo(250);
CSS
#f {
background:#ace;
padding:20px;
width:200px;
position:fixed; top:0; left:0;
}
<div id="f">
I'm going to follow you only so far...
</div>
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
https://hemant9807.blogspot.in/<br />
JS
var windw = this;
$.fn.followTo = function(pos) {
var $this = this,
$window = $(windw);
$window.scroll(function(e) {
if ($window.scrollTop() > pos) {
$this.css({
position: 'absolute',
top: pos
});
} else {
$this.css({
position: 'fixed',
top: 0
});
}
});
};
$('#f').followTo(250);
CSS
#f {
background:#ace;
padding:20px;
width:200px;
position:fixed; top:0; left:0;
}
No comments:
Post a Comment