Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]onmouseover
trebron
post 4.12.2022, 18:46:49
Post #1





Grupa: Zarejestrowani
Postów: 32
Pomógł: 0
Dołączył: 8.11.2020

Ostrzeżenie: (0%)
-----


Witam. W globalnych ustawieniach czatu mam m.in. zdefiniowane jak ma wyglądać link z tagiem [urlMovie]
  1. $s = $text;
  2. $s = preg_replace("/\[urlMovie=([^()<>\s]+?)\]((\s|.)+?)\[\/url\]/i", "<i><b><a style='color:#00405E; font-family:Verdana; text-decoration:none;' target=_blank href=/redir.php?url=\\1>\\2</a></b></i>", $s);

Moim celem jest, aby po najechaniu kursorem na link pojawiła się tabelka plakatu z nazwą. W tym celu chcę użyć onmouseover
  1. onmouseover=\"return overlib('<table cellpadding=0 cellspacing=0 border=0 width=100%><td colspan=3 align=center style=\'font-size: 12px; font-weight:bold; background-color:#222323;\'>$name</td><tr>$poster2<td style=\'font-size:11px; font-weight:bold;\'>$opis</td></tr></table>', WIDTH, 500, DELAY, 200);\" onmouseout=\"return nd();\"

Niestety wszelkie proby dodania onmouseover do parametru replacement kończą się fiaskiem.

Ten post edytował trebron 4.12.2022, 18:52:13
Go to the top of the page
+Quote Post
Salvation
post 4.12.2022, 19:24:59
Post #2





Grupa: Zarejestrowani
Postów: 338
Pomógł: 70
Dołączył: 15.07.2014

Ostrzeżenie: (0%)
-----


A nie możesz jedynie dodać klasę do tego co miałeś oryginalnie, a resztę ogarnąć osobnym JS-em spoza tego modułu?
Go to the top of the page
+Quote Post
trebron
post 4.12.2022, 19:46:05
Post #3





Grupa: Zarejestrowani
Postów: 32
Pomógł: 0
Dołączył: 8.11.2020

Ostrzeżenie: (0%)
-----


nie za bardzo wiem jak miałbym to zrobić i gdzie zapisac
Go to the top of the page
+Quote Post
Salvation
post 5.12.2022, 08:34:21
Post #4





Grupa: Zarejestrowani
Postów: 338
Pomógł: 70
Dołączył: 15.07.2014

Ostrzeżenie: (0%)
-----


A co to jest za system z którego korzystasz? Bo skoro masz dostęp do kodu źródłowego, to wystarczy znaleźć odpowiednie miejsce na umieszczenie kodu JS.
Go to the top of the page
+Quote Post
trebron
post 8.12.2022, 00:20:43
Post #5





Grupa: Zarejestrowani
Postów: 32
Pomógł: 0
Dołączył: 8.11.2020

Ostrzeżenie: (0%)
-----


Tylko jak ten kod miałby wyglądać?
Go to the top of the page
+Quote Post
Salvation
post 8.12.2022, 13:24:05
Post #6





Grupa: Zarejestrowani
Postów: 338
Pomógł: 70
Dołączył: 15.07.2014

Ostrzeżenie: (0%)
-----


Nie testowałem, ale sprawdź. No i musisz ten kod JS dopisać we własnym zakresie.

  1. $s = preg_replace("/\[urlMovie=([^()<>\s]+?)\]((\s|.)+?)\[\/url\]/i", '<a class="poster" data-poster-info="true" target="_blank" href="/redir.php?url=\\1">\\2</a>', $s);

  1. a.poster {
  2. color: #00405e;
  3. font-family: Verdana;
  4. font-style: italic;
  5. font-weight: bold;
  6. text-decoration: none;
  7. }

[JAVASCRIPT] pobierz, plaintext
  1. const $posters = document.querySelectorAll('a.poster[data-poster-info="true"]');
  2.  
  3. $posters.forEach(($poster) => {
  4. $poster.addEventListener('mouseover', (event) => {
  5. // yours code
  6. });
  7. });
[JAVASCRIPT] pobierz, plaintext


Ten post edytował Salvation 8.12.2022, 13:25:23
Go to the top of the page
+Quote Post
trebron
post 15.12.2022, 00:56:53
Post #7





Grupa: Zarejestrowani
Postów: 32
Pomógł: 0
Dołączył: 8.11.2020

Ostrzeżenie: (0%)
-----


Niestety nic z tego, pewnie robie cos źle, nie za bardzo wiem czy utworzyc nowy plik js i z jaką nazwa, czy dopisac gdzies w pliku ten kod js
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 28.03.2024 - 18:06