Skip to content

Instantly share code, notes, and snippets.

@1forh
Last active July 3, 2024 14:24
Show Gist options
  • Select an option

  • Save 1forh/9e64e73e0e146ea54e7d to your computer and use it in GitHub Desktop.

Select an option

Save 1forh/9e64e73e0e146ea54e7d to your computer and use it in GitHub Desktop.

Revisions

  1. 1forh revised this gist May 4, 2016. 2 changed files with 4 additions and 4 deletions.
    4 changes: 2 additions & 2 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    <div id="map__wrapper">
    <iframe id="map__canvas"></iframe>
    <div id="map-wrapper">
    <iframe id="map-canvas"></iframe>
    </div>
    4 changes: 2 additions & 2 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    // Iframe wrapper ID set to #map__wrapper
    // Iframe ID set to #map__canvas
    // Iframe wrapper ID set to #map-wrapper
    // Iframe ID set to #map-canvas

    var wrapper = $('#map-wrapper');
    var canvas = $('#map-canvas');
  2. 1forh revised this gist May 2, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,8 @@
    // Iframe wrapper ID set to #map__wrapper
    // Iframe ID set to #map__canvas

    var wrapper = $('#map__wrapper');
    var canvas = $('#map__canvas');
    var wrapper = $('#map-wrapper');
    var canvas = $('#map-canvas');

    // Prevent map zoom on scroll
    // Enable the pointer events only on click
  3. 1forh revised this gist Jan 12, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -12,10 +12,10 @@ canvas.addClass('scroll-off');

    // Enable pointer events on wrapper click
    wrapper.on('click', function () {
    canvas.removeClass('scroll-off');
    canvas.removeClass('scroll-off');
    });

    // Disable pointer events when the mouse leaves the canvas
    canvas.mouseleave(function () {
    canvas.addClass('scroll-off');
    canvas.addClass('scroll-off');
    });
  4. 1forh revised this gist Jan 12, 2016. 1 changed file with 10 additions and 7 deletions.
    17 changes: 10 additions & 7 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,21 @@
    // Iframe wrapper ID set to #map__wrapper
    // Iframe ID set to #map__canvas

    var wrapper = $('#map__wrapper');
    var canvas = $('#map__canvas');

    // Prevent map zoom on scroll
    // Enable the pointer events only on click

    // Disable pointer events on doc ready
    $('#map__canvas').addClass('scroll-off');
    canvas.addClass('scroll-off');

    // Enable pointer events on #map__wrapper click
    $('#map__wrapper').on('click', function () {
    $('#map__canvas').removeClass('scroll-off');
    // Enable pointer events on wrapper click
    wrapper.on('click', function () {
    canvas.removeClass('scroll-off');
    });

    // Disable pointer events when the mouse leaves #map__canvas
    $("#map__canvas").mouseleave(function () {
    $('#map__canvas').addClass('scroll-off');
    // Disable pointer events when the mouse leaves the canvas
    canvas.mouseleave(function () {
    canvas.addClass('scroll-off');
    });
  5. 1forh revised this gist Jan 12, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion main.js
    Original file line number Diff line number Diff line change
    @@ -14,5 +14,5 @@ $('#map__wrapper').on('click', function () {

    // Disable pointer events when the mouse leaves #map__canvas
    $("#map__canvas").mouseleave(function () {
    $('#map_canvas').addClass('scroll-off');
    $('#map__canvas').addClass('scroll-off');
    });
  6. 1forh revised this gist Jan 12, 2016. 2 changed files with 10 additions and 10 deletions.
    4 changes: 2 additions & 2 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    <div id="map_wrapper">
    <iframe id="map_canvas"></iframe>
    <div id="map__wrapper">
    <iframe id="map__canvas"></iframe>
    </div>
    16 changes: 8 additions & 8 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,18 @@
    // Iframe wrapper ID set to #map_wrapper
    // Iframe ID set to #map_canvas
    // Iframe wrapper ID set to #map__wrapper
    // Iframe ID set to #map__canvas

    // Prevent map zoom on scroll
    // Enable the pointer events only on click

    // Disable pointer events on doc ready
    $('#map_canvas').addClass('scroll-off');
    $('#map__canvas').addClass('scroll-off');

    // Enable pointer events on #map_wrapper click
    $('#map_wrapper').on('click', function () {
    $('#map_canvas').removeClass('scroll-off');
    // Enable pointer events on #map__wrapper click
    $('#map__wrapper').on('click', function () {
    $('#map__canvas').removeClass('scroll-off');
    });

    // Disable pointer events when the mouse leaves #map_canvas
    $("#map_canvas").mouseleave(function () {
    // Disable pointer events when the mouse leaves #map__canvas
    $("#map__canvas").mouseleave(function () {
    $('#map_canvas').addClass('scroll-off');
    });
  7. 1forh revised this gist Jan 12, 2016. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -4,10 +4,10 @@
    // Prevent map zoom on scroll
    // Enable the pointer events only on click

    // Set the pointer events to none on doc ready
    // Disable pointer events on doc ready
    $('#map_canvas').addClass('scroll-off');

    // Set the pointer events true on click
    // Enable pointer events on #map_wrapper click
    $('#map_wrapper').on('click', function () {
    $('#map_canvas').removeClass('scroll-off');
    });
  8. 1forh revised this gist Jan 12, 2016. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion main.js
    Original file line number Diff line number Diff line change
    @@ -13,7 +13,6 @@ $('#map_wrapper').on('click', function () {
    });

    // Disable pointer events when the mouse leaves #map_canvas
    // Set the pointer events to none when mouse leaves #map_canvas
    $("#map_canvas").mouseleave(function () {
    $('#map_canvas').addClass('scroll-off');
    });
  9. 1forh revised this gist Jan 12, 2016. No changes.
  10. 1forh revised this gist Jan 12, 2016. 1 changed file with 10 additions and 5 deletions.
    15 changes: 10 additions & 5 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -2,13 +2,18 @@
    // Iframe ID set to #map_canvas

    // Prevent map zoom on scroll
    // you want to enable the pointer events only on click;
    $('#map_canvas').addClass('scroll-off'); // set the pointer events to none on doc ready
    // Enable the pointer events only on click

    // Set the pointer events to none on doc ready
    $('#map_canvas').addClass('scroll-off');

    // Set the pointer events true on click
    $('#map_wrapper').on('click', function () {
    $('#map_canvas').removeClass('scroll-off'); // set the pointer events true on click
    $('#map_canvas').removeClass('scroll-off');
    });

    // you want to disable pointer events when the mouse leave the canvas area;
    // Disable pointer events when the mouse leaves #map_canvas
    // Set the pointer events to none when mouse leaves #map_canvas
    $("#map_canvas").mouseleave(function () {
    $('#map_canvas').addClass('scroll-off'); // set the pointer events to none when mouse leaves the map area
    $('#map_canvas').addClass('scroll-off');
    });
  11. 1forh revised this gist Jan 12, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion main.js
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    // Set iframe wrap with an ID of #full-map
    // Iframe wrapper ID set to #map_wrapper
    // Iframe ID set to #map_canvas

    // Prevent map zoom on scroll
  12. 1forh revised this gist Jan 12, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion main.js
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@

    // Prevent map zoom on scroll
    // you want to enable the pointer events only on click;
    $('#map_canvas').addClass('scrolloff'); // set the pointer events to none on doc ready
    $('#map_canvas').addClass('scroll-off'); // set the pointer events to none on doc ready
    $('#map_wrapper').on('click', function () {
    $('#map_canvas').removeClass('scroll-off'); // set the pointer events true on click
    });
  13. 1forh revised this gist Jan 12, 2016. 3 changed files with 5 additions and 5 deletions.
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    <div id="full-map">
    <div id="map_wrapper">
    <iframe id="map_canvas"></iframe>
    </div>
    6 changes: 3 additions & 3 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -4,11 +4,11 @@
    // Prevent map zoom on scroll
    // you want to enable the pointer events only on click;
    $('#map_canvas').addClass('scrolloff'); // set the pointer events to none on doc ready
    $('#full-map').on('click', function () {
    $('#map_canvas').removeClass('scrolloff'); // set the pointer events true on click
    $('#map_wrapper').on('click', function () {
    $('#map_canvas').removeClass('scroll-off'); // set the pointer events true on click
    });

    // you want to disable pointer events when the mouse leave the canvas area;
    $("#map_canvas").mouseleave(function () {
    $('#map_canvas1').addClass('scrolloff'); // set the pointer events to none when mouse leaves the map area
    $('#map_canvas').addClass('scroll-off'); // set the pointer events to none when mouse leaves the map area
    });
    2 changes: 1 addition & 1 deletion style.css
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,3 @@
    .scrolloff {
    .scroll-off {
    pointer-events: none;
    }
  14. 1forh revised this gist Jan 12, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    <div id="full-map">
    <iframe id="map_canvas"></iframe>
    </div>
  15. 1forh revised this gist Jan 12, 2016. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions style.css
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    .scrolloff {
    pointer-events: none;
    }
  16. 1forh revised this gist Jan 12, 2016. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,14 @@
    // Set iframe wrap with an ID of #full-map
    // Iframe ID set to #map_canvas1
    // Iframe ID set to #map_canvas

    // Prevent map zoom on scroll
    // you want to enable the pointer events only on click;
    $('#map_canvas1').addClass('scrolloff'); // set the pointer events to none on doc ready
    $('#map_canvas').addClass('scrolloff'); // set the pointer events to none on doc ready
    $('#full-map').on('click', function () {
    $('#map_canvas1').removeClass('scrolloff'); // set the pointer events true on click
    $('#map_canvas').removeClass('scrolloff'); // set the pointer events true on click
    });

    // you want to disable pointer events when the mouse leave the canvas area;

    $("#map_canvas1").mouseleave(function () {
    $("#map_canvas").mouseleave(function () {
    $('#map_canvas1').addClass('scrolloff'); // set the pointer events to none when mouse leaves the map area
    });
  17. 1forh revised this gist Dec 3, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    // Set iframe wrap with an ID of #full-map
    // Iframe ID set to #map_canvas1

    // Prevent map zoom on scroll
    // you want to enable the pointer events only on click;
    $('#map_canvas1').addClass('scrolloff'); // set the pointer events to none on doc ready
  18. 1forh created this gist Dec 3, 2015.
    12 changes: 12 additions & 0 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    // Prevent map zoom on scroll
    // you want to enable the pointer events only on click;
    $('#map_canvas1').addClass('scrolloff'); // set the pointer events to none on doc ready
    $('#full-map').on('click', function () {
    $('#map_canvas1').removeClass('scrolloff'); // set the pointer events true on click
    });

    // you want to disable pointer events when the mouse leave the canvas area;

    $("#map_canvas1").mouseleave(function () {
    $('#map_canvas1').addClass('scrolloff'); // set the pointer events to none when mouse leaves the map area
    });