summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorprashantsinalkar2018-08-06 16:06:03 +0530
committerprashantsinalkar2018-08-06 16:06:03 +0530
commited93409f9a01717c612c3d03ff95966d547f4cc7 (patch)
tree8bf6dbfeea446c492ebcc193788d7d1b3f07a0fa /static
parent8f19376ea5c5cf438a9357bac7243532734e3e6f (diff)
downloadSciPy2018-ed93409f9a01717c612c3d03ff95966d547f4cc7.tar.gz
SciPy2018-ed93409f9a01717c612c3d03ff95966d547f4cc7.tar.bz2
SciPy2018-ed93409f9a01717c612c3d03ff95966d547f4cc7.zip
added image gallary
Diffstat (limited to 'static')
-rwxr-xr-xstatic/website/bootstrap-css/custom.css20
-rw-r--r--static/website/js/custom.js93
-rw-r--r--static/website/templates/index.html169
3 files changed, 242 insertions, 40 deletions
diff --git a/static/website/bootstrap-css/custom.css b/static/website/bootstrap-css/custom.css
index 25a4231..0f03c3b 100755
--- a/static/website/bootstrap-css/custom.css
+++ b/static/website/bootstrap-css/custom.css
@@ -12,3 +12,23 @@ if it's not present, don't show loader */
z-index: 9999;
background: url(images/loader-64x/Preloader_2.gif) center no-repeat #fff;
}
+
+.btn:focus, .btn:active, button:focus, button:active {
+ outline: none !important;
+ box-shadow: none !important;
+}
+
+#image-gallery .modal-footer{
+ display: block;
+}
+
+.thumb{
+ margin-top: 15px;
+ margin-bottom: 15px;
+}
+.modal-header {
+ border-bottom: none; !important
+}
+.modal-footer {
+ border-top: none; !important
+}
diff --git a/static/website/js/custom.js b/static/website/js/custom.js
new file mode 100644
index 0000000..2573428
--- /dev/null
+++ b/static/website/js/custom.js
@@ -0,0 +1,93 @@
+let modalId = $('#image-gallery');
+
+$(document)
+ .ready(function () {
+
+ loadGallery(true, 'a.thumbnail');
+
+ //This function disables buttons when needed
+ function disableButtons(counter_max, counter_current) {
+ $('#show-previous-image, #show-next-image')
+ .show();
+ if (counter_max === counter_current) {
+ $('#show-next-image')
+ .hide();
+ } else if (counter_current === 1) {
+ $('#show-previous-image')
+ .hide();
+ }
+ }
+
+ /**
+ *
+ * @param setIDs Sets IDs when DOM is loaded. If using a PHP counter, set to false.
+ * @param setClickAttr Sets the attribute for the click handler.
+ */
+
+ function loadGallery(setIDs, setClickAttr) {
+ let current_image,
+ selector,
+ counter = 0;
+
+ $('#show-next-image, #show-previous-image')
+ .click(function () {
+ if ($(this)
+ .attr('id') === 'show-previous-image') {
+ current_image--;
+ } else {
+ current_image++;
+ }
+
+ selector = $('[data-image-id="' + current_image + '"]');
+ updateGallery(selector);
+ });
+
+ function updateGallery(selector) {
+ let $sel = selector;
+ current_image = $sel.data('image-id');
+ $('#image-gallery-title')
+ .text($sel.data('title'));
+ $('#image-gallery-image')
+ .attr('src', $sel.data('image'));
+ disableButtons(counter, $sel.data('image-id'));
+ }
+
+ if (setIDs == true) {
+ $('[data-image-id]')
+ .each(function () {
+ counter++;
+ $(this)
+ .attr('data-image-id', counter);
+ });
+ }
+ $(setClickAttr)
+ .on('click', function () {
+ updateGallery($(this));
+ });
+ }
+ });
+
+// build key actions
+$(document)
+ .keydown(function (e) {
+ switch (e.which) {
+ case 37: // left
+ if ((modalId.data('bs.modal') || {})._isShown && $('#show-previous-image').is(":visible")) {
+ $('#show-previous-image')
+ .click();
+ }
+ break;
+
+ case 39: // right
+ if ((modalId.data('bs.modal') || {})._isShown && $('#show-next-image').is(":visible")) {
+ $('#show-next-image')
+ .click();
+ }
+ break;
+
+ default:
+ return; // exit this handler for other keys
+ }
+ e.preventDefault(); // prevent the default action (scroll / move caret)
+ });
+
diff --git a/static/website/templates/index.html b/static/website/templates/index.html
index f2e5896..52e68f7 100644
--- a/static/website/templates/index.html
+++ b/static/website/templates/index.html
@@ -19,6 +19,7 @@
<link rel="stylesheet" href="{% static 'website/bootstrap-css/bower_components/ionicons/css/ionicons.min.css' %}">
<link rel="stylesheet" href="{% static 'website/bootstrap-css/assets/css/main.css' %}">
<link rel="stylesheet" href="{% static 'website/bootstrap-css/assets/css/custom.css' %}">
+ <link rel="stylesheet" href="{% static 'website/bootstrap-css/custom.css' %}">
<script type="text/javascript">
// Wait for window load
@@ -448,51 +449,138 @@ jQuery(document).ready(function($){
<h3 class="section-title">Memories of SciPy 2017</h3>
</div>
</div>
+
<div class="row">
- <div class="col-md-12">
- <ul class="grid">
-
- <li class="grid-item grid-item-sm-6">
- <img alt="" class="img-responsive center-block" src="{% static 'website/bootstrap-css/assets/images/photos/photos-1.jpg' %}">
- </li>
+ <div class="row">
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-1.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-1.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-2.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-2.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
- <li class="grid-item grid-item-sm-3">
- <img alt="" class="img-responsive center-block" src="{% static 'website/bootstrap-css/assets/images/photos/photos-3.jpg' %}">
- </li>
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-3.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-3.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-4.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-4.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-5.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-5.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
- <li class="grid-item grid-item-sm-3">
- <img alt="" class="img-responsive center-block" src="{% static 'website/bootstrap-css/assets/images/photos/photos-9.jpg' %}">
- </li>
-
- <li class="grid-item grid-item-sm-3">
- <img alt="" class="img-responsive center-block" src="{% static 'website/bootstrap-css/assets/images/photos/photos-11.jpg' %}">
- </li>
-
- <li class="grid-item grid-item-sm-3">
- <img alt="" class="img-responsive center-block" src="{% static 'website/bootstrap-css/assets/images/photos/photos-6.jpg' %}">
- </li>
-
- <li class="grid-item grid-item-sm-3">
- <img alt="" class="img-responsive center-block" src="{% static 'website/bootstrap-css/assets/images/photos/photos-7.jpg' %}">
- </li>
-
- <li class="grid-item grid-item-sm-3">
- <img alt="" class="img-responsive center-block" src="{% static 'website/bootstrap-css/assets/images/photos/photos-8.jpg' %}">
- </li>
-
- <li class="grid-item grid-item-sm-3">
- <img alt="" class="img-responsive center-block" src="{% static 'website/bootstrap-css/assets/images/photos/photos-2.jpg' %}">
- </li>
-
- <li class="grid-item grid-item-sm-3">
- <img alt="" class="img-responsive center-block" src="{% static 'website/bootstrap-css/assets/images/photos/photos-10.jpg' %}">
- </li>
- <li class="grid-item grid-item-sm-3">
- <img alt="" class="img-responsive center-block" src="{% static 'website/bootstrap-css/assets/images/photos/photos-5.jpg' %}">
- </li>
- </ul>
+
+
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-6.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-6.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-7.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-7.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-8.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-8.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-9.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-9.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-10.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-10.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
+ <div class="col-lg-3 col-md-4 col-xs-6 thumb">
+ <a class="thumbnail" href="#" data-image-id="" data-toggle="modal" data-title=""
+ data-image="{% static 'website/bootstrap-css/assets/images/photos/photos-11.jpg' %}"
+ data-target="#image-gallery">
+ <img class="img-thumbnail"
+ src="{% static 'website/bootstrap-css/assets/images/photos/photos-11.jpg' %}"
+ alt="Scipy 2017">
+ </a>
+ </div>
+ </div>
+
+
+ <div class="modal fade" id="image-gallery" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+ <div class="modal-dialog modal-lg">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h4 class="modal-title" id="image-gallery-title"></h4>
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span>
+ </button>
+ </div>
+ <div class="modal-body">
+ <img id="image-gallery-image" class="img-responsive col-md-12" src="">
+ </div>
+ <div class="modal-footer">
+ <button type="button" class="btn btn-secondary float-left" id="show-previous-image"><i class="fa fa-arrow-left"></i>
+ </button>
+
+ <button type="button" id="show-next-image" class="btn btn-secondary float-right"><i class="fa fa-arrow-right"></i>
+ </button>
+ </div>
+ </div>
+ </div>
</div>
</div>
+
</div>
</section>
@@ -619,6 +707,7 @@ jQuery(document).ready(function($){
<script src="{% static 'website/bootstrap-css/bower_components/bootstrap/dist/js/bootstrap.min.js' %}"></script>
<script src="{% static 'website/bootstrap-css/bower_components/smooth-scroll/dist/js/smooth-scroll.min.js' %}"></script>
<script src="{% static 'website/bootstrap-css/assets/js/main.js' %}"></script>
+ <script src="{% static 'website/js/custom.js' %}"></script>
</body>
</html>