Skip to content

Instantly share code, notes, and snippets.

@internetbird
Last active December 22, 2015 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save internetbird/6522143 to your computer and use it in GitHub Desktop.
Save internetbird/6522143 to your computer and use it in GitHub Desktop.
Ugly use of Jquery.append. Any Ideas on how to improve this?
function drawZoomButtons() {
for (var i = 1; i <= numOfTicks; i++) {
var position = (canvas.width / numOfTicks) * i;
(function (sectionNum) {
var zoomInBtn = $("<div>")
.addClass("timelineZoomInButton")
.css({ left: position + 120 })
.on("click", function () {
zoomInTimeline(sectionNum);
});
$("#taskTimeLineZoomButtons").append(zoomInBtn);
})(i);
}
}
@internetbird
Copy link
Author

After the fix everything look much better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment