Side panel -> change click to hover.

Side panel -> change click to hover.

Welcome!

I have a script on the sliding side panel:

  1. $(document).ready( function() {
  2. $(".slide_button").hover(function () {
  3. xx = $(this).attr('class');
  4. if (xx=='slide_button') {
  5. $("#my-panel").animate({
  6. left: "0px"
  7. }, 500);
  8. } else {
  9. $("#my-panel").animate({
  10. left: "-220px"
  11. }, 500);
  12. }
  13. $(".slide_button").toggleClass("cls");
  14. });
  15. });
It opens when you click the button, and I would like that this action was you hover over it (hover), how can I get one?
I tried .click replace to .hover, but then I still setting forth and hid.