Im trying to add features to the portfolio section and im having a hard time following the programming flow of the ajax call to open the portfolio items. I cannot find anywhere in the code where its calling the ajax to actually display the portfolio. I have been throught the portfolio_custom.js a few times and i have been able to do a few changes.
Right now i want to display a popup map when someone click on the icon inside the portfolio item. I have the template working with a map overlay but i need to run the google map javascript after the div is visible to fill in the map. How can i do this? So here is my example code:
function initMap() {
var myLatLng = {lat: -25.363, lng: 131.044};
var map = new google.maps.Map(document.getElementById("fabulocity_map"), {
zoom: 4,
center: myLatLng
});
var marker = new google.maps.Marker({
position: myLatLng,
map: map,
title: 'Hello World!'
});
}
When i call initMap() in the showProject function google gives me an error because the <div class="fabulocity_map"></div> is not in the document yet. How can ensure this function gets called only after the portfolio is actually displayed?
I also tried calling it in $(document).ready(function() but it also doesnt work.
I am trying to find out where to inject the code at the end of the ajax call.
I also made an attempt to use GeoFields map in the view along with a colorbox, but I have the same issue where i cannot get the content to load inside the ajax call because it requires it to run certain javascripts.
I did manage to hack in the addtoany icons by placing them right inside the showProject() function and extracting the title from the innerTxt from a div. But this all seems overly complex.
Hi,
You could take a look at template of ajax in 2 files below:
+ views-view--portfolio.tpl.php(sites\all\themes\md_alpine\template\views\portfolio)
+ node--portfolio.tpl.php (sites\all\themes\md_alpine\template)
I looked at those 2 templates but there are no actual ajax calls, all the template does it call a hyperlink with parameter /#!?q=ajax_portfolio&nid=x
Where is the actual ajax function that it calls when you run that link. I need to add something so that when the ajax function is complete i can run some javascript to populate div's that are created during the ajax call.
Here is what im looking for at some point there needs to be a call that i can check if the ajax response finished, where can i add the do_something_here() function?
Hi,
+ Please open file portfolio_custom.js (sites/all/themes/md_alpine/js/lib).
+ Find event named:
$(window).bind('hashchange', function() { ...... });