multiple profile2 + multiple getlocations field on jquery tabs

WE HAVE MOVED!

Please visit our new Drupal Website at https://www.xenyo.com我們的新網頁設計公司網頁.

  //we need profile2 + field_group + field_multiple + getlocations modules
  drupal_add_css("http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css", array('type' => 'external'));
   drupal_add_js("http://code.jquery.com/ui/1.9.2/jquery-ui.js");
 
    drupal_add_js( '
    $= jQuery;
    $(document).ready(function() {
      $(".ui-tabs-anchor").live("click", function() {
        $.each(Drupal.settings.getlocations_fields, function (key, settings) {
          if(getlocations_map[key] != undefined) {
             google.maps.event.trigger(getlocations_map[key], "resize");   // this will fix google map display problem
           }
        })
      })
    function tabme() {   //create ul list for jquery ui tabs
      window.tabstr = "<ul>";
      $(".field-group-multiple .multiple-inline-element").each(function(i,e) {
        var tabname = "tabs-"+i;
        $(this).attr("id", tabname);
        window.tabstr += "<li><a href=\'#" + tabname + "\'>" + "Profile" + (i+1) + "</a></li>";
      })
      window.tabstr += "</ul>";
      $(".field-group-multiple").prepend(window.tabstr);
      $(".field-group-multiple").tabs();
      getlocations_init();   //reinitialize map display , see getlocations.js
      getlocations_fields_init();  //reinitialize geocoder , see getlocations_fields.js
      Drupal.attachBehaviors(document);
  }
    $("body").ajaxComplete(function(event,request, settings){
      if(settings.context.extraData._triggering_element_value != undefined && settings.context.extraData._triggering_element_value  == "Add another item") {  // while mulitiple profile add more button is clicked
        tabme();
      }
    });
    tabme();
  });
   ', 'inline');
Help Share this Article