I know superfish has implemented jQuery sf-Touchscreen plugin, is it possible to get something similar ?

CommentFileSizeAuthor
#17 1389664-17.patch1.34 KBkalman.hosszu

Comments

danielhonrade’s picture

did you try 1 tap and 2 taps?

danielhonrade’s picture

Status: Active » Closed (won't fix)

no reply from the issuer

pkchoo’s picture

Version: 6.x-2.21 » 7.x-1.42

I have the same issue. I doesn't respond at all to any type of interaction (single-press, double-press, etc.).

I just assumed that because the menu title is a span that it's not recognized by the iOS device. If this is supposed to work that would be great!

Thanks,
Joe

danielhonrade’s picture

you can try adding a path, and set it to hover.

I think that would translate to 2 taps for iphone

Any ideas how to overcome this would be welcome.

danielhonrade’s picture

Status: Closed (won't fix) » Active
danielhonrade’s picture

may site http://www.danielhonrade.com is using span tag on menu, upper left, seems working fine on tap

danielhonrade’s picture

Status: Active » Closed (fixed)

closed, no reply from the author

sammys’s picture

Neither single nor double tap works. The workaround is to use a single space as the path.

pkchoo’s picture

That's nice to know. I'll try it. Thanks!

-Joe

TravisJohnston’s picture

This was done in D6:

Just some input on what I ended up doing for this with the site im working on now.

First I created a new node with the title of No Link, so I point links to this node when I want the link to not be clickable, such as a parent link. This is needed for mobile or else when a user taps the parent link, it will just go to the link instead of allowing the user to see the drop down (sometimes you get lucky and it shows the drop down, but not for all devices)

So create the page, then grab the node ID and link the parent link to that. Now in your template.php, add this:

<?php
function themename_menu_item_link($link) {
  if (empty($link['localized_options'])) {
    $link['localized_options'] = array();
  }
  if ($link['type'] && $link['href'] == 'node/id') {
    return '<a href="javascript:void(0)" class="nolink">'. $link['title'] .'</a>';
  }
  else {
    return l($link['title'], $link['href'], $link['localized_options']);
  }
}
?>

this will place the standard javascript:void(0) into the string so it won't try to load anything. Hope this helps someone.

*Edit: I should note that you only need to replace the 'themename' and the 'id' in this script so they match your setup.

giacomino00’s picture

if you put a blank space then if the user click on the menu it appears the "page not found" error.

If nothing else is possible, it would be great to have as a path # so that, if the user clics, the same page is reloaded.
Now it is not possible to do that because the # is changed to its entity.

TravisJohnston’s picture

gia,

if my solution doesn't work, which I understand is true for D7, try http://#

But replacing the menu path with anything other than javascript:void(0) will cause the mobile browser to still try and open whatever the link may be. My original solution is obviously for D6, but the same idea can be applied to D7, though I am not sure what the exact code would be

minneapolisdan’s picture

I just came across this, not sure how this is marked as 'fixed' when the issue still exists, does it not? Or do we consider the solutions in #10 and #12 the fix? They are very appreciated solutions, I guess I just saw them as temporary fixes.

I looked at one of the sample sites listed on this module's homepage, http://www.activelivingresearch.org/. That site has a similar menu, where the top level items are not links, and yet it does work on mobile devices (e.g. - iPad). I'm not sure what the difference is, unless they used a custom script on that site. I did notice that each of the top-level links has the same ID, "om-link-inactive", which is unusual. That may be key to their solution.

At any rate, for now I will TravisJohnston's suggestion of http://#

Great module, love it, thanks for any help out there.

georgemastro’s picture

Just put a space in Anchor and leave the Path empty. It will be translated to http://mysite.com/#

kalman.hosszu’s picture

Category: feature » bug
Status: Closed (fixed) » Active

I tested it on andorid and it works well, but on IOS the tap doesn't work.

coolbits’s picture

I solved the problem:
In om_maximenu.render.inc change:

else {
    // title with javascript should have div tag
    $script_link = om_string_name($content['link_title'], FALSE);
      
    // title contains some block elements 
    $link_tag = ((isset($content['php_option']) && ($content['php_option'] == 1)) || ($script_link == 'Script Link')) ? 'div': 'span';

    // useful when you just want a button for getting the content to show and not actually linking to anything
    $vars['om_link'] = '<' . $link_tag . $span_id . ' class="' . $attributes['class'] . '" ' . $span_title . '>' . $link_option . '</' . $link_tag . '>';
  }

on

else {
    // title with javascript should have div tag
    $script_link = om_string_name($content['link_title'], FALSE);
      
    // title contains some block elements 
    $link_tag = ((isset($content['php_option']) && ($content['php_option'] == 1)) || ($script_link == 'Script Link')) ? 'div': 'a';

    // useful when you just want a button for getting the content to show and not actually linking to anything
    $vars['om_link'] = '<' . $link_tag. ' href="javascript:void(0)"' . $span_id . ' class="' . $attributes['class'] . '" ' . $span_title . '>' . $link_option . '</' . $link_tag . '>';
  }

It works on my site. My site - block "КАТЕГОРИИ ТОВАРОВ".

kalman.hosszu’s picture

Version: 7.x-1.42 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new1.34 KB

I attached a patch based on #16.

Please review and test it!

danielhonrade’s picture

Hi all,

Anybody interested in co-maintaining this module is very much welcome.

Daniel

mattsmith3’s picture

this is glorious. thanks for the patch!

TravisJohnston’s picture

Hey I just wanted to opt in a simple javascript solution if you want to disable a link's action if you want it to do nothing more than open a drop down.

To start, I use menu attributes so I can give my link a class. In this case the class is portfolio since I don't have an actual portfolio page but I do have a bunch of pages in a drop down that I want my mobile users to be able to access.

In your theme's js file.

$('ul.menu a.portfolio').toggle(function(e) {
				e.preventDefault();
				$('ul.menu li ul.menu').show("fast");
			   }, function() {
				$('ul.menu li ul.menu').hide("fast");	
});

So I am targeting the portfolio class link, which was set to go to page , and disabling the Default. Then I am setting it up so on toggle or click, it opens its child menu. This is a little to generic though so you will need to better specify the child menu to open, since I only have 1 drop down, ul.menu ul.menu works fine for me. Though you may want to look into a more specific target by also placing a class on the parent LI item. Hope this helps.

mattsmith3’s picture

Status: Needs review » Reviewed & tested by the community

I'm using #17 successfully on several sites now.

Not sure what the procedure is here, but recommending to apply this patch to the module.

kalman.hosszu’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ergophobe’s picture

I ported the patch to the D6 version, but that did not do what I needed.

#20 was helpful, but too general. I modified that to grab the parent element of that link, then use that to target the show/hide function

<script>
$(document).ready(function () {
    $('ul.om-menu > li.om-leaf a').click(function (e) {
        e.preventDefault();
		$('.om-maximenu-content').hide("fast");
        var parentId = $(this).parent().attr("id");
        var mySelector = '#' + parentId + ' div.om-maximenu-content';
        $(mySelector).toggle("fast");
    });
});
</script>
tostinni’s picture

The patch works fine to open the menu but if you click again on the menu item, it won't close the menu.
Any idea ?