Anonymous Anonymous - 2 months ago
142 0

No description

Javascript

js

$("img.kp-preview").hover(function(event) {
    var titleid  =  $(this).attr('id');
    var request  =  new XMLHttpRequest();
    var titleurl =  'http://api.kinopoisk.cf/getFilm?filmID='+titleid;
		var divid    =  '#div'+titleid;
    request.open('GET', titleurl);

		request.onreadystatechange = function () {
		if (this.readyState === 4) {
		var t = JSON.parse(this.response);
				$(divid).css({top: event.clientY, left: event.clientX}).show();
        $(divid).append('<div class="modal fade">'+t.description+'</div>')
      }
    };

    request.send();
	 
		   
},
   function() {
    var titleid  =  $(this).attr('id');
    var divid    =  '#div'+titleid;
    $(divid).hide();
	  $(divid+' span:last').remove();
});
Comments