Template:Team:Leeds touchDropDown.js

From 2013.igem.org

(Difference between revisions)
Parsley (Talk | contribs)
(Simple Javascript for dropdwon menu touch screen compatibility)
Newer edit →

Revision as of 10:12, 13 September 2013

/*!

  • AUTHOR: Osvaldas Valutis, www.osvaldas.info
  • Please do check out his site.
  • To implement this script, please copy and paste the following url as the javascript source:
  • https://2013.igem.org/Template:Team:Leeds_touchDropDown.js?action=raw&ctype=text/javascript
  • Happy scripting!
  • /

(function(e,t,n,r){e.fn.doubleTapToGo=function(r){if(!("ontouchstart"in t)&&!navigator.msMaxTouchPoints&&!navigator.userAgent.toLowerCase().match(/windows phone os 7/i))return false;this.each(function(){var t=false;e(this).on("click",function(n){var r=e(this);if(r[0]!=t[0]){n.preventDefault();t=r}});e(n).on("click touchstart MSPointerDown",function(n){var r=true,i=e(n.target).parents();for(var s=0;s<i.length;s++)if(i[s]==t[0])r=false;if(r)t=false})});return this}})(jQuery,window,document)