drupal - jQuery cloned div not reacting on hover function -


i working cms, not have full control on displayed in manner, decided clone container, using code below. clone gets created expected, can see in script (first rows) want have hover effect on it. on original works expected, cloned section not react on hover function, why this? how around it?

<script> $(document).ready(function(){    $("section.block-bookoblock").hover(function(){     $(".block-bookoblock ul.menu").css("display","block");     },function(){     $(".block-bookoblock ul.menu").css("display","none");   });   document.oncontextmenu = function() {return false;};   $('#page:not(#newid)').mousedown(function(e){      if( e.button == 2 ) {      if ($('#newid').length) {     $('#newid').css({ "display": 'block'});     $('#newid').css({ "top": e.pagey +'px'});     $('#newid').css({ "left": e.pagex +'px'});         } else {     var $div = $('#block-bookoblock-book-outline').clone().attr('id','newid');        $('body').append($div);        $('#newid').css({ "top": e.pagey +'px'});       $('#newid').css({ "left": e.pagex +'px'});       $('#newid').css({ "position": 'absolute'});       return false;      }      }     if( e.button == 0 ) {     $('#newid').css({ "display": 'none'});     }     return true;    });      $("#newid").hover(function(){     $(".block-bookoblock ul.menu").css("display","block");     },function(){     $(".block-bookoblock ul.menu").css("display","none");   }); }); </script> 

your hover event applies #newid elements @ time called. have apply future objects, use notation

$("#newid").on('hover', function(){ ... 

of course, shouldn't have 2 objects of same id begin with.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -