Плавное развнорачивание текста

ExVood
На сайте с 02.07.2013
Offline
39
1414

Здравствуйте!

Как сделать кнопку - плавное разворачивание текста на странице? У меня CSS 3. Хочу сделать так, что бы текст даже при свернутом виде оставался индексируемым поисковиками.

forest25
На сайте с 12.09.2009
Offline
67
#1

Скорее всего у вас на сайте уже подключен jquery (хотя это может быть и не так). Проще сделать на нем - $('#element-id').fadeIn();

VPS 512MB 20GB SSD KVM - 5$ (http://u.hmdw.me/digitalocean) | ИМХО о хостингах (http://u.hmdw.me/hosting)
ExVood
На сайте с 02.07.2013
Offline
39
#2
forest25:
Скорее всего у вас на сайте уже подключен jquery (хотя это может быть и не так). Проще сделать на нем - $('#element-id').fadeIn();

Так и есть, скрипт какой то подключен:


!function ($) {

"use strict"; // jshint ;_;

$(function () {

$.support.transition = (function () {

var transitionEnd = (function () {

var el = document.createElement('bootstrap')
, transEndEventNames = {
'WebkitTransition' : 'webkitTransitionEnd'
, 'MozTransition' : 'transitionend'
, 'OTransition' : 'oTransitionEnd otransitionend'
, 'transition' : 'transitionend'
}
, name

for (name in transEndEventNames){
if (el.style[name] !== undefined) {
return transEndEventNames[name]
}
}

}())

return transitionEnd && {
end: transitionEnd
}

})()

})

}(window.jQuery);/* ==========================================================
* bootstrap-alert.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#alerts
* ==========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */


!function ($) {

"use strict"; // jshint ;_;


/* ALERT CLASS DEFINITION
* ====================== */

var dismiss = '[data-dismiss="alert"]'
, Alert = function (el) {
$(el).on('click', dismiss, this.close)
}

Alert.prototype.close = function (e) {
var $this = $(this)
, selector = $this.attr('data-target')
, $parent

if (!selector) {
selector = $this.attr('href')
selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
}

$parent = $(selector)

e && e.preventDefault()

$parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())

$parent.trigger(e = $.Event('close'))

if (e.isDefaultPrevented()) return

$parent.removeClass('in')

function removeElement() {
$parent
.trigger('closed')
.remove()
}

$.support.transition && $parent.hasClass('fade') ?
$parent.on($.support.transition.end, removeElement) :
removeElement()
}


/* ALERT PLUGIN DEFINITION
* ======================= */

var old = $.fn.alert

$.fn.alert = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('alert')
if (!data) $this.data('alert', (data = new Alert(this)))
if (typeof option == 'string') data[option].call($this)
})
}

$.fn.alert.Constructor = Alert


/* ALERT NO CONFLICT
* ================= */

$.fn.alert.noConflict = function () {
$.fn.alert = old
return this
}


/* ALERT DATA-API
* ============== */

$(document).on('click.alert.data-api', dismiss, Alert.prototype.close)

}(window.jQuery);/* ============================================================
* bootstrap-button.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#buttons
* ============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============================================================ */


!function ($) {

"use strict"; // jshint ;_;


/* BUTTON PUBLIC CLASS DEFINITION
* ============================== */

var Button = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.button.defaults, options)
}

Button.prototype.setState = function (state) {
var d = 'disabled'
, $el = this.$element
, data = $el.data()
, val = $el.is('input') ? 'val' : 'html'

state = state + 'Text'
data.resetText || $el.data('resetText', $el[val]())

$el[val](data[state] || this.options[state])

// push to event loop to allow forms to submit
setTimeout(function () {
state == 'loadingText' ?
$el.addClass(d).attr(d, d) :
$el.removeClass(d).removeAttr(d)
}, 0)
}

Button.prototype.toggle = function () {
var $parent = this.$element.closest('[data-toggle="buttons-radio"]')

$parent && $parent
.find('.active')
.removeClass('active')

this.$element.toggleClass('active')
}


/* BUTTON PLUGIN DEFINITION
* ======================== */

var old = $.fn.button

$.fn.button = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('button')
, options = typeof option == 'object' && option
if (!data) $this.data('button', (data = new Button(this, options)))
if (option == 'toggle') data.toggle()
else if (option) data.setState(option)
})
}

$.fn.button.defaults = {
loadingText: 'loading...'
}

$.fn.button.Constructor = Button


/* BUTTON NO CONFLICT
* ================== */

$.fn.button.noConflict = function () {
$.fn.button = old
return this
}


/* BUTTON DATA-API
* =============== */

$(document).on('click.button.data-api', '[data-toggle^=button]', function (e) {
var $btn = $(e.target)
if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
$btn.button('toggle')
})

}(window.jQuery);/* ==========================================================
* bootstrap-carousel.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#carousel
* ==========================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================== */


!function ($) {

"use strict"; // jshint ;_;


/* CAROUSEL CLASS DEFINITION
* ========================= */

var Carousel = function (element, options) {
this.$element = $(element)
this.options = options
this.options.pause == 'hover' && this.$element
.on('mouseenter', $.proxy(this.pause, this))
.on('mouseleave', $.proxy(this.cycle, this))
}

Carousel.prototype = {




}(window.jQuery);

Он такой длинный что даже сюда не могу его вставить)

Вы ввели слишком длинный текст (59897 символов). Пожалуйста, сократите его до 10000 символов.

Как на нем сделать $('#element-id').fadeIn(); ? Я со скриптами мало дружу..

IL
На сайте с 20.04.2007
Offline
435
#3
forest25:
Проще сделать на нем - $('#element-id').fadeIn();

Возможно, под "разворачивание" скорее slideDown подойдёт

---------- Post added 18-07-2013 at 17:43 ----------

ExVood:
Как на нем сделать $('#element-id').fadeIn(); ? Я со скриптами мало дружу..

для начала прямо в код страницы вставить в тэге <script>.. в нижней части где-нибудь. Для решения таких задач есть смысл подружиться.

... :) Облачные серверы от RegRu - промокод 3F85-3D10-806D-7224 ( http://levik.info/regru )
дани мапов
На сайте с 06.09.2012
Offline
204
#4

HTML


<div class="pressit" style="color: #6F6F6F;">Развернуть/Свернуть</div>
<div class="spoiler">
Здесь контент блока
</div>

Javascript


<script type="text/javascript">
$(document).ready(function(){
$('.pressit').click(function(){
$('.spoiler').slideToggle("slow");
})
})
</script>

Написание и доработка скриптов (PHP, MySQL, JavaScript, jQuery) (/ru/forum/811046)
ExVood
На сайте с 02.07.2013
Offline
39
#5
дани мапов:
HTML


<div class="pressit" style="color: #6F6F6F;">Развернуть/Свернуть</div>
<div class="spoiler">
Здесь контент блока
</div>



Javascript

<script type="text/javascript">
$(document).ready(function(){
$('.pressit').click(function(){
$('.spoiler').slideToggle("slow");
})
})
</script>

А можно как-то сделать чтоб изначально оно свернуто было?!

Den73
На сайте с 26.06.2010
Offline
523
#6
ExVood:
А можно как-то сделать чтоб изначально оно свернуто было?!

hide() 10 раз

ExVood
На сайте с 02.07.2013
Offline
39
#7
Den73:
hide() 10 раз

Ну и где это прописывать?

---------- Добавлено 19.07.2013 в 03:42 ----------

.......???

дани мапов
На сайте с 06.09.2012
Offline
204
#8
ExVood:
А можно как-то сделать чтоб изначально оно свернуто было?!

В файл css можно добавить


.spoiler {display:none}
IL
На сайте с 20.04.2007
Offline
435
#9
ExVood:
Ну и где это прописывать?

$(document).ready(function(){
$('.spoiler').hide();// <-- здесь
ExVood
На сайте с 02.07.2013
Offline
39
#10
ivan-lev:
$(document).ready(function(){

$('.spoiler').hide();// <-- здесь

Тю блин, а я не мог разобраться почему не работает, а оказывается hide нужно было прописывать самым 1ым))) Спасибо!

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий