page transitions using javascript - javascript

i saw this on a site a couple of days ago and i cant seem to find it again.
in any case, this is what was on the site:
the page opened regularly when you entered the url. upon clicking one of the links on the page, it "transitioned" to the next page (there was a color change). and the url in the address bar was changed to reflect that. eg: if the background was blue on site.com, when clicking on the about link, the background would change to green and the browser would show site.com/about. and so on.
also, if the url entered was site.com/about, the bg would be green and on cliking the home page, the site would transition from green to blue and browser would show site.com
im interested in finding out how this was done. searching on google got me the meta-refresh tag, but the ffect was much more complex and worked on all browsers.
is there any other method out there?

There are a lot of realizations. The simplest way is jQuery

You can find page transition generator right here :
http://www.designerwiz.com/mf.htm?http&&&www.designerwiz.com/generator/dhtml_page_effect_generator.htm
if you wanna do it via jQuery, here is a tutorial about it :
http://weston.ruter.net/projects/jquery-css-transitions/
and sample :
http://weston.ruter.net/projects/jquery-css-transitions/code/example.html

Related

How to add transition background to buttons when visiting from One webpage to another depending on which webpage you came from?

I have a design Idea to implement in navigation buttons in which When the user clicks any other button the background of the current button, say "HOME" transition to the button the user clicked, when the webpage the user selected is loaded, WHILE simultaneously changing the font color of the button text.
Below is an image which will give you want I want to do. Any idea or any website you have sen this working will work. The font color is exactly what I want to transition.
Thanking you in advance.
How it should look on webpage
you will need to use ajax to implement this as it will only be possible in an SPA. An application that refreshes would defeat the use of transitions. I cant write the code for you but will be able to help you if you have a code sample u have tried

Sliding page transitions with new content pre-loaded underneath

I am working on a project where the client wants a way of transitioning between content that basically works like page turning on an e-reader app. When you click on a link to go forward, the current content slides to the left and new content is revealed as it slides. If you click on a link to go backwards, the content slides in from the left and is superimposed. (If you're jumping to a page further off it's fine for the page to reload.)
There needs to be a distinct URL for each content block, and ideally this should work all the way down to IE7. Assume there are at least 50 pages, each with at least 2-300 words.
I know there are lots of jQuery page transition options, but most of the ones that I've looked at slide in the new content while the old content is sliding off or fades in the new content after the old content is gone (think slide.js). What I need is basically curtain.js that is vertical, triggered by a link instead of scrolling, and doesn't need to load in all of the content on the page at once.
Here's one way I've come up with possibly building this:
Current content is loaded in from the database (or whatever)
Content for the previous and next pages are also loaded in and stored in hidden divs
When a link is clicked, the current page slides off (or the previous page slides in)
The content that's no longer needed is deleted
New content is "preloaded" with AJAX and hidden
Local URL also changes with AJAX
Here's a crude diagram
That seems really inelegant, though. Is what I've outlined above possible to do? What would be a better way of doing this?
I am okay with JS/jQuery and PHP, learning AJAX.
I'd suggest jQuery UI tabs
No need to deal with AJAX. Just get the server to spit out the 50 pages of texts once and that's a wrap.
It's pretty straightforward to hook into the API, which gives you more control over the entire procedure. Enough control to hook up a function that updates the address bar when you tab through.

Seamless page loads

I've seen some similar questions about this around here but I didn't see anything that might be able to help me here. I am making a web site and I want each page to fade in on load and fade out when someone clicks a link. I have that down with jQuery but between the pages there is a white flash before the pages load. I tried moving around my javascript but in some cases the page didn't load correctly. I'm a bit new to this so I may need a bit of explanation on any possible solutions.
Here is the live site:
http://codyshawdesign.com
The HTML is valid in 4.01 Transitional. I've heard about something like Ajax or pagination but I am unsure how to implement those or what I would have to do to put it in my site or if it would even be the most ideal solution. Thanks for any help!
Shouldn't you only update a portion of a page, not the whole page? Now you have many full scale pages with different file names. The page address changes so the whole page is loaded. It's like refreshing the current with ctrl+r/cmd+r page and that isn't very ajaxy.
One solution would be to have a master page which contains all of the common elements between pages such as header, footer and navigation bar. On that page you have a div (or some other area) where you load information dynamically from a different file. What info is loaded could be determined with GET variables via anchor tags or ajax form buttons.
See for example this link and it's demo.
http://www.queness.com/post/328/a-simple-ajax-driven-website-with-jqueryphp
It's pretty basic but it demonstrates the idea not to load the whole page but only a portion of it. Add some styles and you're ready to go.
Sorry if this doesn't help. Maybe there is a way to refresh the whole page without the white flash. Easy solution would be to change the background color to white but then again, it wouldn't be very ajaxy...
With do pagination you would have to return all pages right when the the user visits your index.php and then you would use javascript to show and hide the right divs as the user clicks the links in menu, that's not good in your case, it'll make the user wait for the entire site even if he's not willing to look at all of it.
AJAX seems the right way, and u can easily implement it with jQuery load method. Just to get you started:
$(function(){
$("a").click(function(e){
e.preventDefault();
$("#pageContent").load($(this).attr("href"));
);
});
This should cause all your links to replace the content of the pageContent div with the content returned by the link without flashing the screen.

Reload iFrame CSS

I'm developing a system, which supports CSS themes. It's Ok so far, I can change the theme as desired, but the system is composed by two parts:
First is the "skeleton" of the system: it contains the menu and the options to change theme. That menu loads the contents of the second part which is composed essentially by an iframe which loads the modules called by the clicks on menu.
I can change the theme of the first part of the system using the following code:
$("link").attr("href", "css/temas/"+theme_name+".css");
The theme_name is gathered by reading the link on the menu click. The system is ok here, and no change is needed. Beyond changing the main theme, it records a cookie, which is used to read for further system theming.
So, the second part of the system also reads that cookie to apply the theme, but it doesn't change instantly as the main part does!
For example, when I click the theme icon, it instantly applies the theme without refreshing the screen, but that doesn't happens to the second part! It apply the theme, but it's shown only if I reload the iframe, and reloading, ain't cool!
I'm trying to change the iframe theme with the following code:
$("#ifr_main link").attr("href", theme_name);
Where #ifr_main is the iframe name!
Does anybody knows how can I figure that out and apply the new CSS without having to refresh the page, as I do on the menu?
You need to select the content of the iFrame first before trying to select it's link element.
$("#ifr_main").contents().find("link").attr("href", theme_name);
Side note, iFrames can be ugly :)
It is because iframe content was loaded when your page is loaded, so after it, you cannot change its looking unless you are using JQuery/ajax methods or reload.
Yo can find some questions about it
here, here and here
maybe you can reload your ifreame via ajax, read here
Finally you should watch this video for more unique way.

change colour of another page

Using java script is it possible to change the background color of another page, ie if i say i want the background colour to be blue, i would type it into a text box on one page, and when i click the link to the page i want the background color to be blue, its blue.
If this is possible how would i go about it???
If both pages are in (i)frames or one page is in an iframe of the other it is possible using cross-frame scripting. It is also possible if one of the pages is a popup produced by the other.
If not then it is only possible by making a whole bunch of server script and using forms and automatic refreshes or AJAX, not soemthing easily explained.
No, you won't know exactly when that other page has completed loading, if you do, then you can simply get the document.body of that other page and change the background-color style (as long as the other page is not in a different domain and the user doesn't quickly close the page where the link is).

Categories

Resources