How to achieve fixed position background scroll/reveal effect? jQuery plugin available?
You can do this with CSS. All you need is some divs that are the same height as the window, with different background images with the property background-attachment: fixed;
.
#one
{
background: url(http://images.buzzillions.com/images_products/07/02/iron-horse-maverick-elite-mountain-bike-performance-exclusive_13526_100.jpg);
background-repeat: no-repeat;
background-position: center center;
background-attachment:fixed;
}
#two
{
background: url(http://img01.static-nextag.com/image/GMC-Denali-Road-Bike/1/000/006/107/006/610700673.jpg);
background-repeat: no-repeat;
background-position: center center;
background-attachment:fixed;
}
http://jsfiddle.net/Kyle_/mbhLN/
Easing effect for position:fixed div
I got solution
I hope it will help someone!
HTML
<a class="blog_button" href="#" title="Blog"><img src="images/blog_butn.png" alt="blog"></a>
CSS
.blog_button{
position: absolute;
right:0;
top:50%;
z-index: 5000;
}
jQuery--
$(window).scroll(function(){
var bb= $(document).scrollTop();
var ac_height=$( window ).height()/2.3;
bb=parseInt(bb)+parseInt(ac_height);
var h=bb+'px'
$('.blog_button').animate({top:h},50);
});
Need help simulating this scroll-fade jQuery effect
You could use a plugin like http://johnpolacek.github.io/superscrollorama/ or http://daneden.github.io/animate.css/
Make a div scroll out to reveal main content which is placed below
Here we go,
Scroll Magic is an awesome plugin I have used in the past,
Use that with GSAP animation library and you will have smooth animations.
The tutorial is in the link I have attached
http://scrollmagic.io/examples/basic/section_wipes_natural.html
Move background-image position along a path when scrolling
Thanks for the input guys.
I actually found the sort of thing I was after here: http://joelb.me/scrollpath/
Great jQuery plugin that uses the canvas element to render a path and jQuery control the scroll along it. Events/functions can also be triggered at every way point.
Element scrolls into position fixed, then scrolls out of fixed position again, with dynamic content
I found a solution on my own! I found this very helpful and extremely easy to implement plugin called Stickem : https://github.com/davist11/jQuery-Stickem
So for anyone else looking for an answer, here's your help :)
Jquery Sliding to position effect after fadeout from list
Do you want to do scrolling/rotating vertical menu items into left side?
http://jsbin.com/welcome/53677
<!DOCTYPE HTML>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
var ad_refresh=setInterval(function(){
var $target=$("div.manufacturer_list ul li:first");
$target.animate({
marginLeft: -200,
opacity: 0,
}, function(){
$target.css({
marginLeft: 200
}).appendTo('div.manufacturer_list ul').animate({
marginLeft: 0,
opacity: 1
})
});
},1000);
</script>
<style type="text/css">
.manufacturer_list {
width: 800px;
height: 40px;
overflow: hidden;
}
.manufacturer_list li {
float:left;
width: 200px;
}
</style>
</head>
<body>
<div class="manufacturer_list">
<ul>
<li>foo1</li>
<li>foo2</li>
<li>foo3</li>
<li>foo4</li>
<li>foo5</li>
</ul>
</div>
</body>
</html>
How can I make a div stick to the top of the screen once it's been scrolled to?
You could use simply css, positioning your element as fixed:
.fixedElement {
background-color: #c0c0c0;
position:fixed;
top:0;
width:100%;
z-index:100;
}
Edit: You should have the element with position absolute, once the scroll offset has reached the element, it should be changed to fixed, and the top position should be set to zero.
You can detect the top scroll offset of the document with the scrollTop function:
$(window).scroll(function(e){
var $el = $('.fixedElement');
var isPositionFixed = ($el.css('position') == 'fixed');
if ($(this).scrollTop() > 200 && !isPositionFixed){
$el.css({'position': 'fixed', 'top': '0px'});
}
if ($(this).scrollTop() < 200 && isPositionFixed){
$el.css({'position': 'static', 'top': '0px'});
}
});
When the scroll offset reached 200, the element will stick to the top of the browser window, because is placed as fixed.
Related Topics
JavaScript Style.Display="None" or Jquery .Hide() Is More Efficient
Auto Tab to Next Input Field When Fill 4 Characters
JavaScript Invalidcharactererror When Modifying a CSS Name with a Space
How to Query Whole Dom for Elements Matching Some Computed Style ? (In Pure Js)
Write Custom Text on Image Canvas with Fabric.Js and HTML5
Select Box Truncating Text When Body Font Size Changed via JavaScript on Document Ready in Ie 9
Webkit Scrollbar Dynamic Styling
How to Get the Exact Rgba Value Set Through CSS via JavaScript
How to Change CSS Href="" Using JavaScript
Highcharts.Js - Background Color of Axis Only
How to Reasonably Animate Font Awesome Lock Icons
Add CSS3 Support to IE7+ with JavaScript
Make the Change of "Active" Class in the Menu More Reliable When Scrolling
How to Make Specific Part of a String Bold in Angular 2
Scroll to Bottom in Chat Box in Angularjs
Jquery UI Datepicker: Don't Highlight Today When It Is Also Selected