jQuery Opening Times: Display Business Hours

If you are running a service website like restaurant or cafe, you will find this plugin come in handy. 

[javascript]
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="openingTimes.jquery.min.js"></script>
[/javascript]

[javascript]
$(‘#business_time’).openingTimes({
openingTimes: {
‘Monday’ : [’09:00′ , ’18:00′ ],
‘Tuesday’ : true,
‘Wednesday’ : [’09:00′ , ’18:00′ ],
‘Thursday’ : [’09:00′ , ’18:00′ ],
‘Friday’ : [’09:00′ , ’18:30′ ],
‘Saturday’ : [’09:00′ , ’12:00′ ],
‘Sunday’ : [’09:00′ , ’12:00′ ]
},
openString: "The shop is open", // text to appear when shop is open
closedString: "The shop is closed", // text to appear when shop is closed
openClass: "openClass", // class name added to element when shop is open
closedClass: "closedClass" // class name added to element when shop is closed
});
[/javascript]

[html]
<div style="margin-top: 100px; text-align: center;">
<h1 id="business_time"></h1>
</div>
[/html]

  • ‘Monday’ : [’09:00′ , ’18:00′ ]: opening hours.
  • ‘Tuesday’ : true: if the shop is open the whole day, true can be used.
  • openString: “The shop is open”: text to show when shop is open
  • closedString: “The shop is closed”: text to show when shop is closed
  • Days of the week should be written in full, like Monday, Tuesday.
  • If you are closed for the whole day, don’t add the day to openingTimes parameters.

Leave a Comment

Your email address will not be published. Required fields are marked *