11 Apr 2011
GIF Εικόνες, JavaScript, Άδειες
animation, JavaScript, jQuery, αλλαγή ιστοσελίδας, καινοτόμο
jSwitch is a plug-in for site switching in a nice, and innovating way. Each site you own will not refresh the web page content, instead will appearing with animation over the previews page.
The jSwitch installation is fast and easy. However, to use the jSwitch, you must have the basic knowledge of jQuery selectors usage to install it.
First of all, to use the jSwitch you have to own at least two web sites, with deferent domain names. On each web site create a link that will point to each other with unique ID, or a shared class name.
After you have setup the links to each other web site, you have to load the jSwitch on each web site that will participate into your web sites group too.
After you have load and the jSwitch on each web site, you have to use the following structure to enable the plug-in for each web site:
$(document).ready(
function()
{
$('Element Selector').jSwitch();
}
);
The above is the minimal code you need to install the jSwitch and make it work.
In order to use the jSwitch you have to load the jQuery JavaScript framework and/or the easing library. The load order of that files is the following. First of all you have to load the jQuery library. If you like to use the easing plug-in, then you have to load the easing plug-in and finally to load the jSwitch plug-in.
Site A:
<html>
<head>
<title>Page A title</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="easing.js"></script>
<script type="text/javascript" src="jquery.jSwitch-1.0.0.js"></script>
<script type="text/javascript">
$(document).ready(
function()
{
$('#gtB').jSwitch(
{
openEasing: 'easeOutElastic',
closeDirection: 'rtl',
overlayBackground: '#555'
}
);
}
);
</script>
</head>
<body>
<h1>Page A</h1>
<a href="http://www.siteB.ext" id="gtB">Go to B</a>
</body>
</html>
Site B:
<html>
<head>
<title>Page B title</title>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="easing.js"></script>
<script type="text/javascript" src="jquery.jSwitch-1.0.0.js"></script>
<script type="text/javascript">
$(document).ready(
function()
{
$('#gtA').jSwitch(
{
overlayBackground: 'red',
closeEasingSpeed: 2500
}
);
}
);
</script>
</head>
<body>
<h1>Page B</h1>
<a href="http://www.siteA.ext" id="gtA">Go to A</a>
</body>
</html>