Skip Navigation

[Résolu] Is it possible to change the font size of text within a cluster marker?

This support ticket is created Il y a 5 années et 7 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Ce sujet contient 5 réponses, a 2 voix.

Dernière mise à jour par diyanK Il y a 5 années et 6 mois.

Assisté par: Christian Cox.

Auteur
Publications
#1240408

I am using the following code to customise my cluster markers:

Can I change the font size of clusters (the numbers are too small for my linking).

jQuery( document ).ready( function() {
  var options = {
    styles: [
      {
        'url': '<em><u>lien caché</u></em>',
        'height': '65',
        'width': '65',
        'textColor': '#000'
      },
      {
        'url': '<em><u>lien caché</u></em>',
        'height': '75',
        'width': '75',
        'textColor': '#000'
      },
      {
        'url': '<em><u>lien caché</u></em>',
        'height': '85',
        'width': '85',
        'textColor': '#000'
      }
    ],
    calculator: function( markers, numStyles ) {
      var index = 0, count = markers.length, dv = count, result = {};
      while (dv > 0) {
        dv = parseInt(dv - 5, 10);
        index++;
      }
      index = Math.min(index, numStyles);
      result = {
        text: count,
        index: index
      };
      return result;
    }
  };
  WPViews.view_addon_maps.set_cluster_options( options, 'map-general' );
});
#1240457

Yes, you can use the 'textSize' property in the style definitions, like this:

jQuery( document ).ready( function() {
  var options = {
    styles: [
      {
        'url': '<em><u>lien caché</u></em>',
        'height': '65',
        'width': '65',
        'textColor': '#000',
        'textSize': 36
      },
      {
        'url': '<em><u>lien caché</u></em>',
        'height': '75',
        'width': '75',
        'textColor': '#000',
        'textSize': 36
      },
      {
        'url': '<em><u>lien caché</u></em>',
        'height': '85',
        'width': '85',
        'textColor': '#000',
        'textSize': 36
      }
    ],
    calculator: function( markers, numStyles ) {
      var index = 0, count = markers.length, dv = count, result = {};
      while (dv > 0) {
        dv = parseInt(dv - 5, 10);
        index++;
      }
      index = Math.min(index, numStyles);
      result = {
        text: count,
        index: index
      };
      return result;
    }
  };
  WPViews.view_addon_maps.set_cluster_options( options, 'map-general' );
});
#1240486

Hah! Funny part is - I actually tried this when trying to figure it out own, but I used the code with the single quotes (like we have it for width and height) - '36'.

Where I can find the full documentation of these properties with the proper syntax?

Thanks!

#1240489

Sorry to reopen, just wanted to make sure my final question about the documentation of style syntax for these options gets answered.

#1240513

I'm not sure where the documentation for each attribute exists, but I found textSize in an example provided by Google here: https://github.com/googlemaps/v3-utility-library/blob/master/markerclusterer/examples/advanced_example.html

#1241764

I see, looks like this is part works on Google's side.. anyway, great job! Let's close this one.