semiromid
(Startpascal)
1
JavaScript not working after Pjax.
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
</head>
<body>
//------Pjax---------
.... NavbarAsset::register($this);
.... container PHP
//------Pjax---------
</body>
</html>
Я use jQuery.
js
$('.lort').hover(
//навели
function () {
navbar_button_alpha($item_a);
console.log("Навели ");
},
//убрали
function () {
console.log(" Убрали ");
}
);
softark
(Softark)
2
Try this instead:
$('body').on('hover', '.lort', function() {
...
});
We should not attach an event handler to the element(s) inside the pjax area that is to be updated by ajax call.
softark
(Softark)
4
Could you give us a little more information?
Just saying “Not working” won’t help you any further.
semiromid
(Startpascal)
5
If use Pjax, need use for loading js scripts it:
$(document).on('ready pjax:success' , function () {
//.......
CODE
//........
});
Thanks You.
softark
(Softark)
6
And where and when are you loading the "$(.lort).hover" part of the script?