Twelve Dozen

Just another WordPress weblog

Jquery slide show for Drupal

If you need a slideshow for your Drupal website, I recommend using JCarousel Lite – http://gmarwaha.com/jquery/jcarousellite/

It has lots of parameters to tweak depending on how you want to set it up. It’s easy to get working.

One slight issue (well major issue really until I fixed it), that I had using this with Drupal was that initially I needed to press F5 to refresh the browser before the images would display.

The fix for it was to surround the code with $(document).ready(function () { }

Here’s my code:

<script type=”text/javascript”>
$(document).ready(function () {
$(”.carousel”).jCarouselLite({
btnNext: “.next”,
btnPrev: “.prev”,
scroll: 1,
auto: 1200,
speed: 1600,
visible: 1
});
});
</script>

  • 0 Comments
  • Filed under: Uncategorized
  • Form Date Picker – jQuery

    I wanted to find a better solution to inputting dates on a form than expecting users to manually input dates.
    I searched for AJAX date pickers and there were a number of options, although a lot of them were calendars and not specific date pickers. I’d heard a lot about jQuery so I decided to give that a go.
    http://docs.jquery.com/UI/Datepicker

    It was very easy to install. Download jQuery. Add the js files to the header of my page. Add the css class to the form input tag.
    In MySQL I was using Date as the field type so I need to adjust the format of the form field to match the date input i.e. 2009-09-01
    Reading the jQuery documents this was fairly simple:
    $(’.datepicker’).datepicker({ dateFormat: ‘yy-mm-dd’ });

    Thinking about it now I could probably use a fairly simple dropdown option for year – month – day, but it’s fun to learn to use jQuery.

  • 0 Comments
  • Filed under: Uncategorized