Simple parallax scrolling doesn't work - javascript

I'm trying to add simple parallax scrolling to my website using stellar.js. The problem is that it just simply doesn't work; I feel like I've tried everything but it just doesn't work. I made this test jsfiddle because I thought it didn't work because it interfered with some of the other code on my website. But even on this test page on which I'm only trying to get parallax scrolling to work it won't work for some reason.
http://jsfiddle.net/5Jctk/4/
I'm calling the stellar.js library like this (as you can see in the fiddle):
$(document).ready(function () {
$.stellar();
});
Why isn't this working on either my website and the jsfiddle?

You didn't set the data-stellar-ratio for each separate element you want to scroll, and also you have to specify the pixel height of each element that scrolls separately.

Related

Scroll speed manipulation css jquery

Find out a website http://www.boy-coy.com/#home. When you scoll down all content scrolls very smooth. Even if you scroll it fast, scroll is done at specific speed. This makes the website faster and responsive. How this can be achieved with the help of css and jquery?
At first glance.
Try reading their html source code output.
They use a few jquery plugins and legacy browser js plugin calls.
They have a custom and partially obfuscated .js script that is in depth, but you can see the specific properties it is setting on items in the page.
Barring any terms of use issues, you could likely decipher this pages cool scroll technique by working with this sample code as an example. But it is definitely a fair amount of work to write from scratch or post the entire solution here.
Im going to go and look for a smaller example that isnt as involved as this parallax.
And check out this link http:// codepen.io/JTParrett/pen/BkDie its got some starting principals here of some of the images positioning at different locations in the viewport when you scroll.
This link in SO can also help Can I change the scroll speed using css or jQuery?
Kirupa has a nice tutorial that can likely help in getting the smoothe scrolling effect stared too. http://www.kirupa.com/html5/smooth_parallax_scrolling.htm
And this one is pretty awesome. I think I would look into this demo. Be sure to test all of click event demos here. Im sure you could tie in your jquery tween event for the scroll bar with this http://plugins.compzets.com/animatescroll/
Another decent example http://bassta.bg/demos/smooth-page-scroll/
It is called Parallax,
Check this: http://www.w3schools.com/howto/howto_css_parallax.asp
http://matthew.wagerfield.com/parallax/

Highlighting nav without jquery

I have a web page with anchor links and I wish for them to stay highlighted when they are clicked AND when the user manually scrolls down. I have seen some jquery code here codepen.io/jakob-e/pen/mhCyx that does what I wish to do, however I wish to achieve this effect using raw javascript and I can't see it posted anywhere. Thanks for any help.
Sounds like you're looking for animated scrolling and scrollspy functionality? Shameless plug for two native JS (non-jQuery) scripts I wrote that are designed to work together:
Smooth Scroll: https://github.com/cferdinandi/smooth-scroll
Gumshoe for scrollspy: https://github.com/cferdinandi/gumshoe

images overlap for masonry and google map not taking up width of division

So basically, I made a simple website.
I am using bootstrap along with masonry jquery and google maps.
This is the basic page of my website.
How this website works is like when gallery is click, index page will fadeout and gallery page is faded in.
Lets go straight to the point which is my CSS. I am wondering what is wrong with it since I am encountering this problem.
My masonry images for gallery will overlap each other but if I place things out of the division class section. Everything is fine. Same goes for the google map width problem.
Things will only be ok after the window is resized manually.
Here are the SS for the problems
my entire css link
http://pastebin.com/kqWaszqF
my custom js link
http://pastebin.com/uqSvaMeT
my index page link
http://pastebin.com/eKHyJV95
As you can see, if I place all this codes for gallery and map outside of everything will be working fine and great but if I put it inside of that . This the above problem happens.
I tried everything like min-width: 100%, width: 100% or whatsoever. Seems like this problem always exist. Even if I setTimeOut to my javascript for masonry and googlemap, it works sometimes but not perfect as it also fails.
Can some kind soul please help me out here?
You need to provide a fiddle with html so i can test it in order to help you.

Scroll multiple DIVs using Javascript Scrollbars

I have the following setting: http://jsfiddle.net/dobbylan/DnmvR/5/
In this example, scrolling the maindiv also scrolls the upper/left div.
However I'd like to exchange the native Scrollbars for Javascript Scrollbars.
I have been searching the web for some simple Javascript code that provides a minimalistic Scrollbar AND allows for scrolling multiple DIVs.
Any hints on a simple JS code snippet that provides a simple Scrollbar and can scroll multiple DIVs?
If you are willing to use jQuery, I found a nifty plugin that will do it for you. It can be styled with CSS, so it can fit the look of your site as well. Check out the demo to see for yourself...
A quick look at the source of the demo page also shows you how to use it:
$("selector").mCustomScrollbar(
[direction],
[easing],
[easing type],
[bottom scrolling space],
[scrollbar adjust],
[mouse-wheel support],
[button-scroll support],
[button-scroll speed]
);

jQuery jScrollpane plugin strange behavior

Please check this site: pixeli.ca/works/italia
There I work on the site. The problem is when I just open this address, it doesn't show two panels using jScrollPane properly - these look like narrow horizontal stripes with content inside them. Then I click any of the top nav bar items and it becomes what it should be - all looks fine. What can I do to make it work right way from the beginning?
Seems like there is something related to jQuery hide() function. When I turn it off in the document, it works well. Did anybody face something like this before?
Yes, I have solved the issue. So, there is a simple animation effect implemented in the site through jQuery fadeIn function. It shows elements gradually first time, then sets a cookie so this animation doesn't work anymore.
Here is a piece of code where I made it work:
setTimeout(function () {
loadContent('about');
$('#doc2').fadeIn(1000);
}, 7000);
The #doc2 div is the main container for content and I noticed that when it is visible and I load content using my function loadContent('about') it works fine but doesn't work right way if #doc2 is hidden. I just added this function to be executed the same time as fading in #doc2 and now it works well. If you have any questions regarding it, please feel free to ask.

Categories

Resources