Skip to content

Instantly share code, notes, and snippets.

@coodix
Last active December 16, 2015 07:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coodix/5402796 to your computer and use it in GitHub Desktop.
Save coodix/5402796 to your computer and use it in GitHub Desktop.
Add flat photos thumbnails with zoom by mouseover at search result page at cian.ru Run this js code in browser console at cian.ru search result page
$.getScript('http://cdn.jsdelivr.net/jquery.lazyload/1.8.4/jquery.lazyload.js', function() {
var $popup = $('<div></div>').css({
position: 'fixed'
});
$('body').append($popup);
$('a[href*="/rent/flat/"]').lazyload({
threshold : 200,
appear: function(elements_left, settings) {
var $container = $(this).closest('div');
$.get($(this).attr('href'), function (data) {
var $photos = $(data).find('.object_descr_images_w');
$photos.find('img').attr('height', '64').mouseover(function(e) {
$popup.html('').append($(this).clone().attr('height', '360'))
.css({
left: e.clientX - $popup.width(),
top: e.clientY - 360,
'z-index': 5,
'box-shadow': '0px 0px 2px 1px #ccc'
}).show();
}).mousemove(function(e) {
$popup.css({
left: e.clientX - $popup.width() - 10,
top: (e.clientY > 370 ? e.clientY - 360 : e.clientY + 10),
});
}).mouseout(function() {
$popup.hide();
});
$container.after($photos);
});
}
});
$(window).trigger('resize');
}) // getScript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment