PDA

Zobacz pełną wersję : Pogrubienie fragmentu tytułu artykułu w Joomla 3?



sylwekb
16-12-2014, 12:44
Czy jest możliwe pogrubienie fragmentu tytułu artykułu lub menu w Joomla 3?
Czy należy włączyć jakiś dodatek?
np Mam "To jest tytuł <b>artykułu</b>" i słowo artykułu chciałem pogrubić i po wstawieniu kodu wyświetla się on na stronie zamiast pogrubienia. W Joomla 1,5 było to możliwe, stosowałem to wielokrotnie.

marian_mk
16-12-2014, 13:15
Mozna to zrobic w prosty sposób poprzez zastosowania javascript , który oflaguje kolejne słowa tytułu znacznikami <span> z odpowiednia klasą - reszta to juz tylko kwestia ostylowania , a skrypt moze wygladac , np tak
$.noConflict();
jQuery( document ).ready(function( $ ) {
$('.page-header h1,.page-header h2,h2.item-title,.moduletable h1,.moduletable h3, .module h3').each(function(){
var text = $(this).text().split(' ');
if(text.length <2)
return;
text[0] = '<span class="firstWord">'+text[0]+'</span>';
if(text[1])
text[1] = '<span class="secondWord">'+text[1]+'</span>';
if(text[2])
text[2] = '<span class="thereWord">'+text[2]+'</span>';
$(this).html(
text.join(' ')
);
});

});

sylwekb
16-12-2014, 13:39
Gdzie ten skrypt ma być wstawiony, do kodu szablonu czy skryptów Joomla?

sylwekb
16-12-2014, 14:40
Wstawiłem po <body> ale jakoś nie chce działać, poniżej przykładowo jak zrobiłem
Wstawiłem do kodu szablonu


**********
$.noConflict();
jQuery( document ).ready(function( $ ) {
$('.page-header h1,.page-header h2,h2.item-title,.moduletable h1,.moduletable h3, .module h3').each(function(){
var text = $(this).text().split(' ');
if(text.length <2)
return;
text[0] = '<span class="firstWord">'+text[0]+'</span>';
if(text[1])
text[1] = '<span class="secondWord">'+text[1]+'</span>';
if(text[2])
text[2] = '<span class="thereWord">'+text[2]+'</span>';
$(this).html(
text.join(' ')
);
});

});
</script>
Wstawiłem do arkusza stylu css

#secondWord{font-weight: bold;}
.secondWord{font-weight: bold;}