diff --git a/app/assets/javascripts/frontend.js b/app/assets/javascripts/frontend.js index fa2e95a..c717991 100644 --- a/app/assets/javascripts/frontend.js +++ b/app/assets/javascripts/frontend.js @@ -1,8 +1,16 @@ (function($) { - $("document").ready(function(){ + $("document").ready(function(){ // Get link data-attribute and make the banner clickable - $('.w-ad-banner__slide').not('[data-link=""]').not(".youtube").addClass('cursor').on("click",function(){ - window.open($(this).data("link"),"_blank"); + $('.w-ad-banner__slide') + .not('[data-link=""]') + .not(".youtube") + .addClass('cursor') + .on("click",function(){ + if( $(this).data('target') === '_blank' ) { + window.open($(this).data("link"), "_blank"); + } else { + window.location.href = ($(this).data("link")); + } }) }) }(jQuery)); \ No newline at end of file