Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Need help with a jquery/javascript code..

    Hi!
    I'm trying to load a function that should return either a string value or a false boolean to an option of jquery plugin.

    Code:
    $('.plots').maphilight({
    	neverOn: false,
    	groupBy: function(){
    					var myBoolean=true;
    					var outputstring='class';
    
    					function (){
    					if(myBoolean==true)
    					return outputstring;
    					else 
    					return false;
    					} 
    
    					function (){
    					if(myBoolean==true){
    					myBoolean=false;
    					}
    				}
    						
    					};,
    	wrapClass: true,
    	shadow: true,
    
       });
    Further to toggle the boolean, I've used this code:

    Code:
    $('#maplink1').mouseover(function(e) {
          $('.blinker').mouseover();
       }).mouseout(function(e) {
          $('.blinker').mouseout();
       }).click(function(e) { e.preventDefault(); switch_boolean(); });

    I'm quite to new to javascript and jquery, but understand how to add plugins to a page via their respective documentation. The above plugin is a map highlight plugin by David Lynch.
    -

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    You have stated and shown what you are doing. What is this issue?, also why are you binding another mouseover inside of a mouseover function? thats kinda weird.

  • #3
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    @DanInMA: I needed to know how to make the groupby Function, RETURN A Boolean/String??
    Default value for groupby is: "false". .... and a true value can by any string like "class", "group1", "group2", etc etc... Even "true" can be passes, but that won't be regarded as a boolean "true", instead it will be considered as an attribute to the map object "<area>"

    I don't know much javascripting, so don't know how to create a function to return boolean false or string "ATTRIBUTE" ...

    Also, as for the code:

    Code:
    $('#maplink1').mouseover(function(e) {
          $('.blinker').mouseover();
       }).mouseout(function(e) {
          $('.blinker').mouseout();
       }).click(function(e) { e.preventDefault(); switch_boolean(); });
    It's a jquery code: "#maplink1" is used as a selector for the mouseover/mouseout funtion1.
    '.blinker' is used as a selector for mouseover/mouseout function2.

    That jquery code is being used to sync mouse hover of two different objects (one is an image map area, and another is text wrapped around <p class=blinker>). So on mouse hover on any of the two objects, the map area is highlightened... whether it's blinking text, or the map area itself. I copied the code in this thread because I had to show the switch_boolean() function for the click function in this jquery...

    I needed to be able to turn off the map highlighting for a particular area (using groupby) when the blinking text would be hovered upon.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •