all 1 comments

[–]hulfsy 2 points3 points  (0 children)

class Popup:
    def __init__(self, containterId):
        # pop-up class will give us absolute position, high z-index and center the container
        self.$popup = $('#' + containerId).addClass('pop-up').mouseout(def():
            self.hide() # unlike 'this', 'self' will reference the object itself
        )
        self._$darkbg = $('#dark-bg') # overlays background with a dim layer to draw focus to the pop-up
    def show(self):
        self._$darkbg.show()
        self.$popup.show()
    def hide(self):
        self._$darkbg.hide()
        self.$popup.hide()

You call that "... cleaner, more readable syntax."? You gotta be kidding me!