No doubt it works but i know it's not a good code.So i want to accomplish
Make it work using one
on()<script> $(document).on("mouseenter", ".BUTTON_ONE", function() { $(this).animate({ \'padding-right\' : 10, },30); }); $(document).on("mouseleave", ".BUTTON_ONE", function() { $(this).animate({ \'padding-right\' : 4, },30); }); $(document).on("mouseenter", ".BUTTON_TWO", function() { $(this).animate({ \'padding-left\' : 10, },30); }); $(document).on("mouseleave", ".BUTTON_TWO", function() { $(this).animate({ \'padding-left\' : 4, },30); }); $(document).on("mouseenter", ".BUTTON_THREE", function() { $(this).animate({ \'padding-left\' : 10, },30); }); $(document).on("mouseleave", ".BUTTON_THREE", function() { $(this).animate({ \'padding-left\' : 4, },30); }); </script>
Maybe like this: :)
Notice that I use
$(document.body)because it's faster & more effective for this case.Working fiddle: http://www.codeply.com/go/uUoOo1vlaB