Skip to content

Instantly share code, notes, and snippets.

@andreibosco
Forked from 1forh/index.html
Created January 12, 2016 05:45
Show Gist options
  • Select an option

  • Save andreibosco/fa6b32d0cefe574d0224 to your computer and use it in GitHub Desktop.

Select an option

Save andreibosco/fa6b32d0cefe574d0224 to your computer and use it in GitHub Desktop.

Revisions

  1. @1forh 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');
    });
  2. @1forh 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');
    });
  3. @1forh 1forh revised this gist Jan 12, 2016. No changes.
  4. @1forh 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');
    });
  5. @1forh 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
  6. @1forh 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
    });
  7. @1forh 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;
    }
  8. @1forh 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>
  9. @1forh 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;
    }
  10. @1forh 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
    });
  11. @1forh 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
  12. @1forh 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
    });