Воскресенье, 12.05.2024, 15:56
Меню сайта
Категории раздела
JQuery плагины [59]
JQuery уроки [69]
PHP полезное [24]
PHP уроки [21]
Css [26]
JS [3]
SQL [9]
Css 3 [17]
Статистика

Онлайн всего: 1
Гостей: 1
Пользователей: 0
Главная » Статьи » JQuery плагины

jQuery пример выпадающего текста

jQuery пример выпадающего текста

Май 20, 2012 | Автор admin рубрика: jQuery примеры и сниппеты

Данный пример показывает как сделать выпадающие блоки с текстом.

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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<html>
 <head>
 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
 
 <style type="text/css"> 
 
 .container_12 {
 margin: 0 auto;
 width: 960px;
 }
 
 .grid_6 {
 width: 420px;
 }
 
 #textpanda {
 background-color:#ffcccc;
 }
 
 .headline {
 background-color: #000000;
 border: 0 0 1px 0 solid #fff;
 color: #ffffff;
 cursor: pointer;
 font-family: georgia;
 margin-top: -14px;
 padding: 10px;
 }
 
 .headline:before {
 color: #ffffff;
 content: " ";
 }
 
 h3.headline {
 margin: 0;
 }
 
 h3.headline:hover {
 background-color: #ff0000;
 }
 
 .expanded:before {
 content: "- ";
 padding-right: 6px;
 }
 
 .content {
 background-color:#ffcccc;
 padding: 20px;
 }
 </style>
 
 </head>
 <body>
 <div class="container_12">
 <div id="textpanda" class="grid_6">
 <h3 class="headline">ONE </h3>
 <p class="content">
 Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? 
 </p>
 
 <h3 class="headline">TWO </h3>
 <p class="content">
 Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. 
 </p>
 
 <h3 class="headline">THREE </h3>
 <p class="content">
 Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?
 </p>
 </div>
 </div>
 </body>
 </style>
 <script type="text/javascript">
 $(document).ready(function() {
 
 var $textpanderContent = $(".content");
 var $headine = $(".headline")
 
 $textpanderContent.hide();
 $headine.click(function() { 
 
 var $headlineThis = $(this);
 
 $headlineThis.next($textpanderContent).slideToggle("fast", function(){
 if ($headlineThis.css("display") == "block") {
 $headlineThis.prev().addClass("expanded");
 }
 else {
 $headlineThis.prev().removeClass("expanded");
 }
 });
 });
 });
 </script>
 </html>
Категория: JQuery плагины | Добавил: ChronoW (26.11.2012)
Просмотров: 689 | Теги: jQuery пример выпадающего текста | Рейтинг: 0.0/0
Всего комментариев: 0
Имя *:
Email *:
Код *: