Anonymous Anonymous - 2 months ago
170 0

No description

Javascript

kinoscript

$("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);
		console.log(this.response);
		$(divid).css({top: event.clientY, left: event.clientX}).show();
        $(divid).append('<span class="disc">'+t.description+'</span>')
      }
    };

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