I’m trying to change the .show() in my code to .reveal(), and I can’t seem how to do this properly. No errors are being generated, as nothing is happening when I select day_listing_mobile <span>s
Here is my JavaScript Code:
(function($) {
var isMobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
if (isMobile) {
$('.event_list').hide(); // setting display:none; on all .event_list <ul> elements
// attach click event to the <span class="day_listing"> elements
$('.day_listing_mobile').click(function() {
var $eventList = $(this).sibling('.event_list');
$('.event_list').hide(); // again hide all possibly shown ones before opening the selected one
$eventList.show(); // setting display:block on sibling <ul> of clicked <span>
$('#myMobileModal').reveal();
});
}
})(jQuery);
Here is what I’m hiding and wanting to reveal:
{cal_cell_content}<span class="day_listing_mobile">{day}</span><div id="myMobileModal" class="reveal-modal"><ul class="event_list">{content}</ul></div>{/cal_cell_content}
{cal_cell_content_today}<span class="day_listing_mobile" id="today_listing">{day}</span><div id="myMobileModal" class="reveal-modal"><ul class="event_list">{content}</ul></div>{/cal_cell_content_today}
The above code is generating <ul>s using CodeIgniter’s Calendar class that I’m .hide()ing on mobile devices, and that I’m wanting to eventually .reveal() instead of .show().
Here is how .reveal() works:
<script type="text/javascript">
$(document).ready(function() {
$('#myButton').click(function(e) {
e.preventDefault();
$('#myModal').reveal();
});
});
</script>
(more information on Reveal by Zurb)
Disclaimer: I’m new to web development, and suck at anything JavaScript related.
html
js
css
// from reveal.css (make sure to include it)
fiddle
http://jsfiddle.net/c4urself/EUPYT/