(1 авг 2015, 09:46) (
0/
1)
[
-1]
function setState (blockName) {
02 $( '#inset_header' +blockName).click
( function () {
03 var blockStateCookie =
$.cookie( 'blockState' );
04 if (blockStateCookie
== null ) var blockState = [1, 1, 1, 1, 1];
05 else var blockState =
blockStateCookie.split( '' );
06 var arrEl =
blockName-1;
07 if ($( this ).parent
().is( '.hide' )) blockState [arrEl] = 1;
08 else blockState
[arrEl] = 0;
09 var blockStateCookie =
blockState.join( '' );
10 $.cookie( 'blockState' ,
blockStateCookie, { expires: 10000, path:
'/' });
11 });
12 };
13 function restoreState
(blockName) {
14 var arrEl = blockName-1,
15 blockStateCookie =
$.cookie( 'blockState' );
16 if (blockStateCookie !=
null ) {
17 blockState =
blockStateCookie.split( '' );
18 if (blockState [arrEl]
== 0) {
19 $( '#inset_header' +blockName).addClass
( 'hide' );
20 }
21
22 }
23 };
24 restoreState ( '1' ); setState ( '1' );
25 restoreState ( '2' ); setState ( '2' );
26 restoreState ( '3' ); setState ( '3' );
27 restoreState ( '4' ); setState ( '4' );
28 restoreState ( '5' ); setState ( '5' );
Добавлено 01.08.15 в 09:56:10:
< script>
function feedback ( elem ){
var right = parseInt ( window. getComputedStyle ( elem , null ) . right ) ;
if ( right < 0 ){
function frameforward (){
elem. style . right = right + 'px' ;
right = right + 7 ;
if ( right > 0 ){
clearInterval ( timerforward) ; }
elem. style . right = right + 'px' ; }
var timerforward = setInterval ( frameforward , 1 ) ; }
else {
function frameback (){
elem. style . right = right + 'px' ;
right = right - 5 ;
if ( right < - 285 ){
clearInterval ( timerback ) ; }
elem. style . right = right + 'px' ; }
var timerback = setInterval ( frameback , 1 ) ; }
}
</ script >
< body>
< div class= "mainBox" onClick = "feedback (this)" >
< div class= "subBox" ></ div >
< div id = "formBlock" >
< form name = "form1" >
< label > Имя пользователя </ label >< br >
< input type = "text" name = "user" title = "Имя пользователя" >< br >
< label > Текст сообщения </ label >< br >