how to simulate page transition animations in a browser (similar to page swipe in mobile)? - html

I have a webpage that shows an image gallery for the current week, and I have a top bar navigation "prev" and "next" links to cycle through the galleries. Currently clicking on the links causes a whole page refresh. I think the user experience would be smoother if, when we click "next" we animate a slide-in of the next page content from right to left, and vice versa, if we click "prev" we animate the previous week of results from left to right (similar to how page transitions work in a mobile app when you swipe). Note, I do not need to detect actual swipe gestures and I think jquery mobile markup is overkill.
To preload the data that will be sliding in I can make an ajax call, or even have the data preloaded in json for me to construct the replacement html off screen. I will use html5 window history push state to change the url to the actual location we will be navigating to. The only thing I haven't been able to find is to do the actual animation. I have looked into carousels, but none of them quite do what I want. Is there an existing library that handles just the animation of page transition, having that slight recoil bounce effect?
Thanks.
EDIT: I just found jquery.animate which I think might do the trick.

There are any number of jQUery based image gallery libraries that you might want to choose from. If you can't find one to transition between different galleries teh way you want to, it should not be a problem to use jQuery to asynchronously load new galleries and then animate them into place.

Related

Information Architecture Options and Method for Site with Loading Animation (Cover Page)

For a project a site is needed where when first loaded an animation appears that fades away and reveals the content of the site. I am fine with creating the animation and all. What I am not sure about is where to place it.
From a site ia point of view I see it like this. Either have the animation on the index page and once done remove that element with js or $ and reveal the index page. This means a reload will always show the animation again. This also means a click on the main logo that leads to the index page will also play the animation again. Something not really wanted or needed.
The only other option I see is having the animation on the index page and once done redirect to the home page where the site content is located. Like this a click on the logo can be set to either the home page or the index page. The info on the home page is also visible without watching the animation again since the home page has a separate nav link in the menu. Only if desired can the animation be watched again by clicking on the main logo.
From my perspective it will be the later. Though I ask you is this good practise? Is it OK to just have an animation on the index page and everything else on the home page?
I was thinking to either post this in https://ux.stackexchange.com/ or https://graphicdesign.stackexchange.com/ but I think this more concerns code architecture rather than design or ux because as mentioned the animation could also be loaded dynamically on the index page and once gone the content is shown on the index page. So you see I am not asking for opinion but rather for the right logic to tackle this task.
What method is best applied for this scenario? Would you consider having the animation on the index page and then redirect to the home page?
Linked
https://stackoverflow.com/questions/22090313/show-an-animation-before-show-my-index-html
https://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-using-jquery
http://www.submittoday.com/splash_pages_and_search_engine_optimization.html
http://stackoverflow.com/a/22090389/1010918
https://stackoverflow.com/questions/30573395/page-loading-animation-method
https://stackoverflow.com/questions/1964839/jquery-please-wait-loading-animation

Overlay one iframe on top of another, scroll them together

Following up on How to rewrite URLs referenced by Javascript code? I'd like to overlay a button on top of someone else's website (e.g. overlay a Paypal button alongside Stackoverflow's bounty button) and have the two <iframe>s scroll together. The button would reside in the top layer. The website would reside in the bottom layer.
I understand that transparent <iframe>s were/are abused for clickjacking but the browser security mechanism seems to block legitimate use-cases. In my case the user is seeing the same button he/she is clicking. It's even possible that this is a browser bug.
Here is what I see under Chrome:
The top <iframe> intercepts all mouse clicks, even for areas that do not contain any components. Meaning, users cannot interact with the bottom layer at all.
If I style the top <iframe> with pointer-events: none the opposite problem occurs: users are able to see the top layer but all mouse clicks go to the bottom layer. Applying pointer-events: auto to child components does not help (clicks still pass through to the bottom layer).
If I size and position the top <iframe> so its area is equal precisely to the button I am trying to overlay, then mouse clicks go to the right layer but the top layer fails to scroll alongside the bottom layer. Meaning, the button always remains in the same absolute position as the bottom layer scrolls.
Is it possible for me to position a button in the top layer so that it always aligns with a certain position in the bottom layer? In the example where I position a Paypal button alongside the Stackoverflow bounty, I expect the Paypal button to scroll off the page as the user scrolls down the question.
https://stackoverflow.com/a/4087397/14731 leads me to believe this is not possible. Is there another way to implement this?
UPDATE: Here is a jsfiddle for you to play with. The test button is found to the right of "NEWS & VIEWS" in the middle of the page.
Update: New approach
Following discussion with Gili below, the requirement for the solution to work across multiple pages made me rethink my solution.
The new approach:
Doesn't require any code changes or specific features on the target site.
Works on every page while the user navigates (as long as they stay on the same domain)
Could be tweaked to inject any HTML/JS into any DOM element within any target page
My solution works as follows:
Send the person you want to demonstrate Widget X to an email with a link to your instructions page
That instructions page contains a bookmarklet which they add to their bookmarks bar
They visit their own site and click your bookmarklet
Your bookmarklet injects javascript into their page
That javascript creates a pop-up window with content that appears to belong to the target domain, since that domain generated the popup
That pop-up window then monitors the DOM on the target browser window (window.opener) and injects our arbitrary HTML whenever the current page doesn't contain our target node ID.
It seems to work well in my testing (perfect in Chrome, haven't tested across all browsers yet) and seems to work on every target site from StackOverflow to Twitter.
Live demo here: How to demo an web widget on a third party site without having access to their code
Sample code below, expanded for readability:
s = "<script type='text/javascript'>setInterval(function() { if(!window.opener.document.getElementById('gctrlPixelator')) {var i=document.createElement('IMG');i.src='//lorempixel.com/400/200/';i.id='gctrlPixelator';i.style.cssText='top:20;right:20;position:absolute;z-index: 9999;';window.opener.document.getElementsByTagName('body')[0].appendChild(i);}},500);</script>";
t = "<div style='text-align: center; font-family: Arial, Helvetica;'><h1 style='font-size: 18px;'>Demo running!</h1> Keep this window open and return to the main site window to continue the demo.</div>";
w = window.open('','name','height=200,width=400');
w.document.write(s);
w.document.write(t);
The above should be converted into a bookmarklet before deploying to an 'instructions' landing page for a potential client.
Original solution
First, sorry for posting this as an answer rather than as a comment. I've been thinking about this for half an hour, and only just realised I need 50 reputation to comment. So, apologies, but I wanted to share...
I agree that it's unlikely there is a cross browser way to do this double iframe trick. I read your other question about javascript URL rewriting and it lead me to an idea: Rather than trying to embed/hijack their site on another URL, how about creating a bookmarklet that allows you to inject your Javascript into their page?
It could work like this:
Direct them to your site where you host the custom bookmarklet link. Ask them to add it to their favorites.
Ask them to go to their own site, then click your bookmarklet in their bookmarks.
This would inject your JS into their page, allowing you to edit the DOM any way you wanted (e.g. changing styles, adding DOM elements, etc.)
Code something like this, converted to a bookmarklet (i.e. wrapped in a function with a javascript: at the start) could do the trick...
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", "http://www.example.com/file.js");
document.getElementsByTagName("head")[0].appendChild(script);
I've tested that in Chrome and it seems happy to load the JS cross-domain. The only rule seems to be that the protocols must match (http or https).
Not quite what you asked for, but a possible solution.

HTML5 prerender/prefetch not working (I get a progressive curtain-like downloading/transition !)

I'm working on a web project and I want to load my webpages with an even transition. What I get right now is my photos and background downloading in a curtain-like manner. I want it to show up when it is all loaded instantly.
I don't mind if there is a progress bar or something but not the curtain-like manner.
I used the prefetch/prerender html 5 tag but with no success..
visit here :
http://hellenic-jewls.com/
and then try to hover to another webpage to see that my images are downloaded progressively like a curtain :
e.g. http://hellenic-jewls.com/classical/
ofcourse when the webpages are cached it's ok.
HTML5 prerender/prefetch doesn't work that way. You use them to hint to the browser that you think that page will be visited next and should therefore be prerendered. There is no guarantee that this will happen though... it's up to the browser to decide if it wants to prerender the page.
Further, there will only be one page prerendered at any one time.
What you can do is hide your images, then use a script like https://github.com/desandro/imagesloaded to signal when the images are loaded, at which point you can show the images (with a fade-in transition if desired)

How to grab video from google street view Hyperlapse

Google created new project based on javascripts. http://hyperlapse.tllabs.io/
Engine creating timelapse video but not generating it as visible video file.
How to get it? Only save from screen by desktop video grabbers?
Ok, I found a way, but its complex.
fist things first though, it wasn't actually made by Google, but by T+L labs using the Google Maps API and JavaScript.
Now, to the interesting part:
You're right when you say that there is no pre-made way to save the output video, so you have to mess around with the source code (to remove the overlays) before using screen capture.
What you will need:
Google Chrome
Screen capture software
Windows Live movie maker
Steps:
First, create your hyper lapse like you normally would.
Once you are ready to export, open 'inspect element' (in most browsers the default key is 'F12')
A window with lots of text should pop up. drag the edge out to enlarge the window.
Move your mouse down over the coloured text. As you do this, different parts of the page should highlight themselves in blue one at a time.
What you are seeing is an automatic system; when you hover your mouse over the code for an object on the site, the browser highlights it for you!
Move the mouse around until you find the section that highlights the scroll-bar at the bottom of the page.
Click once to select it, then press delete. The scroll-bar should vanish.
Repeat steps 6-7 for all the other things on top of the hyper lapse itself.
You should now have a clear space to record!
Finally, before you record, press 'F11' to maximise the window, removing the navigation bar at the top.
Activate your screen capture and record the hyper lapse through (Note: make sure the mouse cursor is off-screen whilst you capture)
Press 'F11' again to regain the navigation bar, and then 'F5' to refresh the page and get the removed objects back.
Use Windows Live movie maker to edit the capture down to the correct section, then export as a high quality film.
You're done!

Transparent PNG menu item backgrounds in IE6 with rollovers

Hi I have been trying to do this for what feels like all my life
I have a list menu with block display links, each link has a sliding doors png background image. I have used this javascript (http://www.ideashower.com/our_solutions/png-hover/) to implement the alphaimageloader fix for ie6 using a transparent gif.
When I test it for the first time it works but if I click to a different page and then click back it doesn't work anymore - the menu completely disappears, I can get it to work again by duplicating the transparent gif and changing it's name, but again if I go to another page and then come back to it, it stops working and the menu dissappears.
Is this a server caching issue or something like that.
Any thoughts on this would be much appreciated!
Thanks
If its caching then maybe the AJAX trick could do.
Create random number each time the code is executed and add it to the transparent gif url.
so in file pngHover.js:
transparentImage =
'/j/transparent.gif';
would be
transparentImage = '/j/transparent.gif?143253214';
To get random number in js google it, it will give you plenty./