Skip to content

Instantly share code, notes, and snippets.

@courgette
courgette / gist:8005576
Created December 17, 2013 14:18
[DRUPAL] ul to select for mobile device
Drupal.theme.ulToSelect = function(selector){
$(selector).once('ulToSelect', function(){
var ul = $(this),
select = '<select id="select"/>';
ul.after(select);
ul.find('li').each(function(){
var text = $(this).text(),
link = $(this).find('a').attr('href');
@courgette
courgette / gist:5292061
Created April 2, 2013 13:06
Hook_css_alter custom
function theme_css_alter(&$css) {
// Css Not allowed for theming
$not_allowed_css = array(
'modules/system/system.base.css',
'modules/system/system.menus.css',
'modules/system/system.messages.css',
'modules/system/system.theme.css',
'sites/all/modules/contrib/ctools/css/ctools.css',
);
foreach ($css as $css_filename => $css_settings) {
//itemLength is the number of element and $item is your item
for(var i = 0; i < itemLength; i=i+4) {
$items
.slice(i, i+4)
.wrapAll('<div class="group"/>');
}
@courgette
courgette / gist:5003591
Created February 21, 2013 09:55 — forked from opi/gist:5003488
/**
* Touch events
*/
// wrapper is a DOM element
wrapper.touch = {}
wrapper.get(0).ontouchstart = function(e) {
// Store start position
wrapper.touch.x = e.touches[0].clientX;
};