See http://jsfiddle.net/masa671/7g37Y/. The map is not being displayed.
It works on Yui (the code in the comments at the bottom of JS), but why not with the basic addDomListener?
Call the API from the left sidebar under External resources.
Add http://maps.google.com/maps/api/js?sensor=false and hit the + sign to add the API to the external resources that will be loaded.
If you use the addDomListener then use No wrap - in <head> in Frameworks and extensions.
Your map will work fine.
Related
I am trying to add custom javascript to wix, but it doesnt work. I have tried almost all I found on google but it doesnt work.
<script type="text/javascript">
window.parent.location.href = "https://url/track"
</script>
The script above needs to be loaded on every wix page, it contains redirection
I was wondering if this is possible in wix?
The way to add custom code to each page in a Wix site is by adding Site code in the built-in IDE.
To access it, enable Dev mode at the top menu and click the Site tab at the editor.
Note that you can't access the DOM directly. However, Wix has a pretty rich API that may cover your needs.
looks like you need to use the wix location API: https://www.wix.com/corvid/reference/wix-location.html#to
From my limited knowledge of wix it seems like your implementation is just wrong for the problem you're trying to solve.
I had a quick read of this article which isn't too old: https://www.wix.com/corvid/forum/community-discussion/page-redirect and it seems like a better approach.
Make sure you've enabled DEV mode and then open the script panel at the bottom of the page.
First, you should import the module that contains the method you need. In your case, that would be wixLocation. Inside the onReady function, you should call winLocation.to method.
import wixLocation from 'wix-location';
$w.onReady(function () {
wixLocation.to("http://some.new.location"))
});
I want to edit some images which can only be done in WPBakery Page Builder. So, when I try to edit the page with it, the frontend editor (page builder) doesn't loads. Console shows the following error:
Although, the library script tag is added before the tag which is using this library:
I don't know if any of this makes sense, but, yeah, I have tried these solutions because they were mentioned on different forums:
Adding charset="utf-8" to external script tag.
Moving the script tag inside Raw HTML element.
Using $(document).ready(function(){}) to enclose the whole of second
script. So, that it loads after everything is loaded.
Unfortunately, none of these worked for me.
The page builder works fine on pages where I don't use the d3.js library. And, the visualization works fine WHEN NOT IN PAGE BUILDER - the library loads up and the visualization is displayed. You can check it out here:
https://conductscience.com/age-when-charles-darwin/
Also, please note that I don't have access to any of the theme files. So, I can't make any changes to functions.php or any other file.
Your question is related to the WPBakery, not Visual Composer plugin. You need to have the latest version 5.7 in order to fix this issue. More information, contact support.wpbakery.com if you have a valid license.
I'm stuck here. I have a html/javascript template I downloaded and it has a sliding sidebar etc using javascript. I have also just created a Map using Google api on this template.
When I have
< !DOCTYPE HTML>
at the top of my html (now php) page, the Embedded Google Map does not work. When I don't have it there the javascript code relating to the sidebar functions does not work. Any ideas?
ANSWER:
I Found a work arround. Instead of using 50% for the div for the Google Map I changed it to absolute value of 500px. This corrected the issue.
For a website I'm trying to load the Google Maps script async, because it makes some browser (Firefox) ignore scrolling before all the scripts are loaded from Google.
I looked at the google developers docs and used their script.
https://developers.google.com/maps/documentation/javascript/examples/map-simple-async
works all perfect as long as you place it inside a <script> tag in your index.html.
But when I place this code for example in my main.js file it isn't working anymore.
Example: http://jsfiddle.net/693xK/
Then I found this example on jsfiddle which seems to work:
http://jsfiddle.net/doktormolle/7cu2F/
But over here the same problem. When I place it inside of my main.js file Google Maps isn't showing up. Everything is global. I get the following error but I don't understand what to do about it. I googled the error message but haven't had any luck.
TypeError: window.initialize is not a function
You're missing to add width and height to your #map-canvas. Also I checked your fiddle, since you're using window.onload = loadScript; so wrap it in head (left corner, under Frameworks & Extensions)
#map-canvas{
width:500px;
height:500px;
}
check this updated JSFiddle.
The Scenario
Using jQuery, I have a page that has a popup overlay containing locations marked using Google Maps.
The overlay works using 2 pages setup as follows:
The main page opens an overlay via a text link to a map. The complete map page is then loaded into the overlay.
The map page itself contains Google's API and initialization code to load the correct map.
As they are, the overlay and map work fine providing I load the whole map page.
The Problem
My problem is, I don't want to load the complete page, I want to load just the particular div holding the map.
I'm using jQuerys Ajax "load" function, (as follows) to load the complete map page.
wrap.load(this.attr("href"))
If I try to change this to load a particular DIV (as follows), the pages DIV content is loaded correctly, except the Google API is not loaded, meaning the map does not display.
wrap.load(this.attr("href")+" #map_wrap")
I have tried including Googles API and initialization code on the first main page that opens the overlay, however, this still doesn't work.
I've also tried embedding the code within the loaded DIV, again, no luck.
The Question
Is there a way to load the map pages API script along with the DIV?
After rearranging the page coding, I solved the problem.
I included the Google Maps API code into the main page that opens the overlay, then when the overlay is opened, I needed to call the Google Map initialize() function.
Problem solved.
Just for the sake of completeness (if it's not too clear for others from your answer), is worth mentioning that it wasn't working because by just calling the DIV element, the necessary Javascript statements (which were outside the scope of that element) weren't being started nor called.
To solve it, you could have started them before using your load method or, as you did, as the general invocation of JS files.