Drupal

Fixing the pesky hastag (#) to %23 rewrite in Drupal 7

There’s been a post or two on drupal.org about hashtags (#) getting rewritten to %23.

This doesn’t cause a lot of problems in the main however, if you’re using them as anchors and/or to target something using jQuery, it’s not ideal.

The best solution I’ve found so far is to update the hook_url_outbound_alter() function in template.php or a custom module.

In this example, I’m using templete.php.

function MYTHEME_url_outbound_alter(&$path, &$options, $original_path) { if (strpos($path, '#') !== false) { $pathExploded = explode('#', $path); list($path, $options['fragment']) = $pathExploded; } }

Just replace MYTHEME with your theme name.

If you have a...

Tagged:Drupal

Making Views Slideshow responsive

** UPDATE **

Usability issues aside, I’ve moved away from the previous technique to using a resize function as follows:

In your theme javascript file add the following lines:

(function($) { function resizeDiv() { var vpW = $(window).width(); var vpH = $(window).height(); var slideshowObjects = '.view-slideshow, .view-slideshow .views-slideshow-cycle-main-frame'; $(slideshowObjects).css({ 'width': vpW + 'px' 'height': vpH + 'px' }); } $(window).resize(function() { resizeDiv(); }); $(document).ready(function() { resizeDiv(); }); }) (jQuery);

In this example I’m setting the slideshow to fill the viewport. Replace the variables on lines 3...

Pages