HeyHo,
normalerweise komme ich mit jQuery ganz gut zurecht, aber ich stehe gerade etwas auf der sagenumworbenen Leitung.
Folgender Code wird innerhalb einer Galerie verwendet.
Code:
<div class='polaroid-gallery galleryid-166'>
<a href="http://xxxx.de/xxxx.jpg" title="ich bin der titel" rel="polaroid_166" class="polaroid-gallery-item showcaption">
<span class="polaroid-gallery-image" title="© ich bin der Copyrighthinweis" style="background-image: url(xxxx); width: 150px; height: 150px;"></span>
</a>
</div>
Jetzt will / muss ich mit jQuery auf "© ich bin der Copyrighthinweis" zugreifen, damit Hinweis auch immer angezeigt wird.
Am Schluss sollte hier Zitat: return '<span id="fancybox-title-over">' + text + '</span>'; in der Variablen text der title="ich bin der titel" und title="© ich bin der Copyrighthinweis" drinstehen.
Ich bekomme es gerade nicht gebacken
Das ist die komplette Funktion:
Code: function init() {
var $ = jQuery.noConflict(),
zIndex = 1000,
imagesCount = $('.polaroid-gallery a.polaroid-gallery-item').size(),
imageStr = (typeof(polaroid_gallery) !== 'undefined' ) ? polaroid_gallery.text2image : 'Image',
thumbsOption = (typeof(polaroid_gallery) !== 'undefined' ) ? polaroid_gallery.thumbnail : 'none',
imagesOption = (typeof(polaroid_gallery) !== 'undefined' ) ? polaroid_gallery.image : 'title3',
scratches = (typeof(polaroid_gallery) !== 'undefined' ) ? polaroid_gallery.scratches : 'yes';
$(".polaroid-gallery a.polaroid-gallery-item").each(function(currentIndex) {
zIndex++;
var width = $(this).width(),
text = jQuery.trim($("span", this).attr('title')),
randNum = $.randomBetween(-12, 12),
randDeg = 'rotate(' + randNum + 'deg)',
randPos = $.randomBackgroundPosition(),
ieFilter = $.ieRotateFilter(randNum);
switch (thumbsOption) {
case 'none':
text = '';
break;
case 'image1':
text = imageStr +' '+ (currentIndex + 1);
break;
case 'image2':
text = imageStr +' '+ (currentIndex + 1) +' / '+ imagesCount;
break;
case 'number1':
text = (currentIndex + 1);
break;
case 'number2':
text = (currentIndex + 1) +' / '+ imagesCount;
break;
}
if(text === '') {
text = ' ';
}
var cssObj = {
'z-index' : zIndex,
'-webkit-transform' : randDeg,
'-moz-transform' : randDeg,
'-ms-transform' : randDeg,
'-o-transform' : randDeg,
'transform' : randDeg
};
var cssHoverObj = {
'z-index' : '1998',
'-webkit-transform' : 'scale(1.15)',
'-moz-transform' : 'scale(1.15)',
'-ms-transform' : 'scale(1.15)',
'-o-transform' : 'scale(1.15)',
'transform' : 'scale(1.15)'
};
var cssIeObj = {
'filter' : ieFilter,
'-ms-filter' : '"'+ ieFilter +'"'
};
if ($.browser.msie && parseInt($.browser.version, 10) < 9) {
$("span", this).after('<span class="polaroid-gallery-text">'+text+'</span>');
$("span.polaroid-gallery-text", this).width(width);
$(this).css(cssIeObj);
} else {
$("span", this).after('<span class="polaroid-gallery-text">'+text+'</span>');
$("span.polaroid-gallery-text", this).width(width);
if(scratches === 'yes') {
$("span.polaroid-gallery-text", this).after('<span class="polaroid-gallery-scratches" style="background-position: '+randPos+';"></span>');
}
}
$(this).css(cssObj);
$(this).hover(function () {
$(this).css(cssHoverObj);
}, function () {
$(this).css(cssObj);
});
});
$(".polaroid-gallery").css('visibility', 'visible');
$(".polaroid-gallery a.polaroid-gallery-item").fancybox({
'padding' : 20,
'margin' : 40,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'titlePosition' : 'inside',
'titleFormat' : function(title, currentArray, currentIndex, currentOpts) {
var text = '';
switch (imagesOption) {
case 'title1':
text = title;
break;
case 'title2':
text = (currentIndex + 1) + ' ' + title;
break;
case 'title3':
text = (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title;
break;
case 'title4':
text = imageStr + ' ' + (currentIndex + 1) + ' ' + title;
break;
case 'title5':
text = imageStr + ' ' + (currentIndex + 1) + ' / ' + currentArray.length + ' ' + title;
break;
case 'image1':
text = imageStr + ' ' + (currentIndex + 1);
break;
case 'image2':
text = imageStr + ' ' + (currentIndex + 1) + ' / ' + currentArray.length;
break;
case 'number1':
text = (currentIndex + 1);
break;
case 'number2':
text = (currentIndex + 1) + ' / ' + currentArray.length;
break;
}
if(jQuery.trim(text) === '') {
text = ' ';
}
return '<span id="fancybox-title-over">' + text + '</span>';
}
});
} ______________ mfg SEO |