Use the jQuery data() function to access HTML 5 data attributes

This commit is contained in:
Tom Hughes 2012-09-06 21:29:16 +01:00
parent 7af04f8691
commit d76aa13ddd
2 changed files with 4 additions and 6 deletions

View file

@ -8,12 +8,10 @@ $(document).ready(function () {
mapZoom = map.getZoom();
$(".mapkey-table-entry").each(function () {
var entryLayer = $(this).attr("data-layer"),
entryZoomMin = parseInt($(this).attr("data-zoom-min")),
entryZoomMax = parseInt($(this).attr("data-zoom-max"));
var data = $(this).data();
if (mapLayer == entryLayer &&
mapZoom >= entryZoomMin && mapZoom <= entryZoomMax) {
if (mapLayer == data.layer &&
mapZoom >= data.zoomMin && mapZoom <= data.zoomMax) {
$(this).show();
} else {
$(this).hide();

View file

@ -49,7 +49,7 @@ $(document).ready(function () {
preview.addClass("loading");
});
preview.load(editor.attr("data-preview-url"), { text: editor.val() }, function () {
preview.load(editor.data("previewUrl"), { text: editor.val() }, function () {
preview.stopTime("loading");
preview.removeClass("loading");
});