fg-collapsible
Advanced tools
Comparing version 0.1.3 to 0.1.4
{ | ||
"name": "fg-collapsible", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"description": "Toggle your collapsible content", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -23,16 +23,36 @@ /* | ||
// tapout/clickout behavior | ||
$( document ).bind( "touchstart." + pluginName + " click." + pluginName, function( a ){ | ||
// if the event target is not in the collapsible, and the collapsible is expanded, and it's a menu presentation... collapse it! | ||
if( !$( a.target ).closest( e.target ).length && | ||
!$( a.target ).closest( $trigger ).length && | ||
!$collapsible.data( pluginName ).collapsed && | ||
isMenu() ){ | ||
var targetTop; | ||
var touchCancel = false; | ||
$( "body" ) | ||
.bind( "gesturestart." + pluginName, function( a ){ | ||
touchCancel = true; | ||
}) | ||
.bind( "touchstart." + pluginName, function( a ){ | ||
targetTop = a.target.getBoundingClientRect().top; | ||
}) | ||
.bind( "touchend." + pluginName + " click." + pluginName, function( a ){ | ||
if( a.type === "touchend" ){ | ||
if( targetTop && Math.abs( targetTop - a.target.getBoundingClientRect().top ) > 5 ){ | ||
touchCancel = true; | ||
} | ||
} | ||
setTimeout(function(){ | ||
$collapsible.data( pluginName ).collapse(); | ||
}); | ||
a.preventDefault(); | ||
} | ||
} ); | ||
// if the event target is not in the collapsible, and the collapsible is expanded, and it's a menu presentation... collapse it! | ||
if( !$( a.target ).closest( e.target ).length && | ||
!$( a.target ).closest( $trigger ).length && | ||
!$collapsible.data( pluginName ).collapsed && | ||
isMenu() && | ||
touchCancel === false ){ | ||
setTimeout(function(){ | ||
$collapsible.data( pluginName ).collapse(); | ||
}); | ||
a.preventDefault(); | ||
} | ||
setTimeout( function(){ | ||
targetTop = null; | ||
touchCancel = false; | ||
}, 200 ); | ||
} ); | ||
// hover behavior for collapsibles and triggers relies on the presence of data-collapsible-hover attr | ||
@@ -39,0 +59,0 @@ if( $collapsible.is( "[data-collapsible-hover]" ) ){ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
43065
832
0