Skip to content

Instantly share code, notes, and snippets.

@sxidsvit
Created February 8, 2018 01:12
Show Gist options
  • Save sxidsvit/5a0e4fab456908ed2876d4d271dfcfd1 to your computer and use it in GitHub Desktop.
Save sxidsvit/5a0e4fab456908ed2876d4d271dfcfd1 to your computer and use it in GitHub Desktop.
Перемещение DOM-элементов из карточки товара в лайтбокс (А.Ладовер)
<script>
var setlbox = function(el) {
var p=$(el);
this.image = function (fromclass,toclass) {
var f=p.find('.'+fromclass);
$('.'+toclass).attr('src',f.attr('src'));
}
this.text = function (fromclass,toclass) {
var f=p.find('.'+fromclass);
$('.'+toclass).text(f.text());
}
this.list = function (fromclass,toclass) {
var fclass='.'+fromclass, dclass='.'+toclass, f=p.find(fclass);
$(dclass).html('').text('');
f.clone().appendTo($(dclass));
$(dclass).children(fclass).addClass('new_div_visible');
$('.new_div_visible').css({'display':'block','opacity':'1'});
}
};
function show_post(el) {
var move = new setlbox(el);
move.image('team_image','image_teams');
move.text('team_name','ld_teams_name');
move.text('team_spec','lb_teams_spec');
move.text('team_u','lb_teams_phdesc');
move.list('list_teams_wr','lb_list_item');
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment