Code Monkey home page Code Monkey logo

Comments (8)

sgruhier avatar sgruhier commented on August 31, 2024

how did you disable dragging?
there is a option draggableMarker: false on address picker initializer
I tried it on the demo and the marker isn't draggable anymore
could you share code?

from jquery-addresspicker.

rickygu avatar rickygu commented on August 31, 2024

I just set draggableMarker to false at line 33 of query.ui.addresspicker.js to disable dragging.

Here is the code I have for displaying the map and form:

<%= content_for(:head) do%>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<% end %>

<script>
    $(function() {
        var addresspickerMap = $( "#addresspicker_map" ).addresspicker({
          elements: {
            map:      "#map",
            lat:      "#lat",
            lng:      "#lng",
            locality: '#locality',
            country:  '#country'
          }
        });
        var gmarker = addresspickerMap.addresspicker( "marker");
        gmarker.setVisible(true);
        addresspickerMap.addresspicker( "updatePosition");
    });
</script>

<p>Make sure the map is pointing your delivery location</p>
<div id='map'></div>

<div class="field">
  <%= f.label :address %><br />
  <%= f.text_field :address, id: "addresspicker_map", class: "ui-autocomplete-input", autocomplete: "off", role: "textbox", :'aria-autocomplete' =>"list", :'aria-haspopup' =>"true" %>
</div>
<div class="field">
  <%= f.label :city %><br />
  <%= f.text_field :city, id: 'locality' %>
</div>
<div class="field">
  <%= f.label :country %><br />
  <%= f.text_field :country, id: 'country' %>
</div>

<%= f.text_field :latitude, id: 'lat', type:'hidden'  %>

<%= f.text_field :longitude, id: 'lng', type: 'hidden' %>

from jquery-addresspicker.

sgruhier avatar sgruhier commented on August 31, 2024

dont touch addresspicker.js
try

        var addresspickerMap = $( "#addresspicker_map" ).addresspicker({
          elements: {
            map:      "#map",
            lat:      "#lat",
            lng:      "#lng",
            locality: '#locality',
            country:  '#country'
          },
          draggableMarker: false
        });

from jquery-addresspicker.

rickygu avatar rickygu commented on August 31, 2024

that breaks the map. I don't want to disable drag able Marker. I just found that if i disable it, i get the correct looking market.

from jquery-addresspicker.

rickygu avatar rickygu commented on August 31, 2024

Ok I think I've pinpointed down the problem. Turns out if I use twitter bootstrap along side jquery ui, it'll mess the map up. Any idea which part of bootstrap may be causing the problem?

from jquery-addresspicker.

rickygu avatar rickygu commented on August 31, 2024

ok turns out it's bootstrap's problem with max-width on the image.

to fix the problem just do
#map img {
max-width: none;
}

from jquery-addresspicker.

sgruhier avatar sgruhier commented on August 31, 2024

great you found the issue!
would have been hard for me to solve that !:)

from jquery-addresspicker.

IAmKio avatar IAmKio commented on August 31, 2024

Thanks! This has solved the issue 👍

from jquery-addresspicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.