Examples of js Implementation of Top-foldable menu toolbar Effects

Source: Internet
Author: User

Examples of js Implementation of Top-foldable menu toolbar Effects

This article mainly introduces how js achieves top-foldable menu toolbar effects, which enables you to slide over the menu toolbar to fold and expand effects, involving javascript mouse events and style operation skills, for more information, see

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN"

Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>

<Html xmlns = "http://www.w3.org/1999/xhtml">

<Head>

<Title> menu toolbar that can be folded </title>

<Style>

Html, body {

Margin: 0;

}

Body {

Url(img.jpg) repeat-x;

}

Ha {

Margin: 0 auto;

}

Img {

Border: none;

}

# Fx_topToolbar {

Position: relative; top:-76px; left: 0;

Margin: 0 auto; height: 92px;

Background: #0C3E74; width: 700px;

Text-align: center;

}

# Fx_topToolbar. shell {

Margin: 0 auto; padding: 13px 0;

}

# Btn_offOn {

Position: absolute; bottom:-8px;

Left: 20px; height: 24px; width: 150px;

Background: url(img34.gif) no-repeat;

}

# Btn_offOn {

Display: block; zoom: 1; height: 24px;

Position: relative; right:-16px;

Background: url(tip.gif) no-repeat 100% 0;

}

</Style>

<Script>

(JS = {

$: Function (o) {return typeof o = "string "? Document. getElementById (o): o },

On: function (o, type, fn ){

O. attachEvent? O. attachEvent ('on' + type, function () {fn. call (o)}): o. addEventListener (type, fn, false );

Return JS. on },

Move: function (who, attr, val, s, fn ){

Var fm = parseInt (who. style [attr]) | 0;

ClearInterval (who ['timer _ '+ attr]);

Var iFx = (function (form, to, s ){

Return function (){

Return form + = Math [form <? 'Ceil ': 'floor'] (to-form) * (s | 0.3 ))};

}) (Fm, val, s );

Who ['timer _ '+ attr] = setInterval (function (){

Var v = iFx ();

Who. style [attr] = v + 'px ';

If (v = val) {fn & fn. call (who); clearInterval (who ['timer _ '+ attr]);};

}, 18 );

}

}). On (window, 'load', function (){

Var Q = JS. $ ('fx _ topToolbar '); Q. style. top ='-74px ';

JS. on (JS. $ ('btn _ offon'), 'mouseover', function () {JS. move (Q, 'top', 0 )})

(Q, 'mouseout', function () {Q. outTimer = setTimeout (function () {JS. move (Q, 'top',-74)}, 10 )})

(Q, 'mouseover', function () {clearTimeout (this. outTimer )});

})

</Script>

</Head>

<Body>

<Div id = "fx_topToolbar">

<Div class = "shell">

<A href = "#" title = "">

</A>

<A href = "#" title = "">

</A>

</Div>

<Div id = "btn_offOn"> <a href = "#" title = ""> </a> </div>

</Div>

</Body>

</Html>

I hope this article will help you design javascript programs.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.