* keywords im content mit Links ersetzen

* Links mit Klasse "show-modal" bei Klick in einen JS-Modal laden, statt dem Link zu folgen

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3296 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
uli 2017-02-17 13:16:15 +00:00
parent 20beca7c4d
commit c924b4af15
15 changed files with 333 additions and 75 deletions

View file

@ -1,6 +1,82 @@
(function($) {
jQuery(document).ready(function($) {
"use strict";
/* ==============================================
VIDEOS
=============================================== */
var videos$ = $('a[id^="video_"]');
function videoInitHandler()
{
var el$ = $(this);
var text = el$.text();
var length = text.length - 11;
var caption = text.substring(0, length);
var expl = this.id.substring(6, this.id.length);
$('<iframe />')
.attr({
width: 680,
height: 466,
src: '//www.youtube.com/embed/'+ expl,
frameborder: 0,
allowfullscreen: true,
'data-st-video': this.id
})
.addClass('st-collapsed')
.hide()
.insertAfter(this)
;
el$
.css('background-image', 'url(/images/st2/icons/arrowup.gif)')
.text(caption + ' einblenden')
.attr('href', 'javascript:void(0);')
;
}
videos$.each(videoInitHandler);
videos$.click(function() {
var el$ = $(this);
var video$ = $('[data-st-video='+ this.id +']');
var text = el$.text();
var length = text.length - 11;
var caption = text.substring(0, length);
if (el$.hasClass('st-collapsed'))
{
video$.slideDown('slow');
el$.text(caption + ' ausblenden');
el$.removeClass('st-collapsed');
}
else
{
video$.slideUp(400);
el$.text(caption + ' einblenden');
el$.addClass('st-collapsed');
}
});
/* ==============================================
KEYWORDS
=============================================== */
var modal$ = $('#st-default-modal');
$('a.show-layer').click(function() {
$.get($(this).attr('href')).then(function(r) {
modal$.find('.modal-body').html(r);
modal$.find('a[id^="video_"]').each(videoInitHandler);
modal$.modal('show');
});
return false;
});
/* ==============================================
HEADER STICKY -->
=============================================== */
@ -339,4 +415,4 @@
firstDay: 1
});
})(jQuery);
});

View file

@ -24,59 +24,4 @@ $(document).ready(function() {
activateTravelDatesTab();
}
var videos$ = $('a[id^="video_"]');
videos$.each(function() {
var el$ = $(this);
var text = el$.text();
var length = text.length - 11;
var caption = text.substring(0, length);
var expl = this.id.substring(6, this.id.length);
$('<iframe />')
.attr({
width: 680,
height: 466,
src: '//www.youtube.com/embed/'+ expl,
frameborder: 0,
allowfullscreen: true,
'data-st-video': this.id
})
.addClass('st-collapsed')
.hide()
.insertAfter(this)
;
el$
.css('background-image', 'url(/images/st2/icons/arrowup.gif)')
.text(caption + ' einblenden')
.attr('href', 'javascript:void(0);')
;
});
videos$.click(function() {
var el$ = $(this);
var video$ = $('[data-st-video='+ this.id +']');
var text = el$.text();
var length = text.length - 11;
var caption = text.substring(0, length);
if (el$.hasClass('st-collapsed'))
{
video$.slideDown('slow');
el$.text(caption + ' ausblenden');
el$.removeClass('st-collapsed');
}
else
{
video$.slideUp(400);
el$.text(caption + ' einblenden');
el$.addClass('st-collapsed');
}
});
});