Posts

Showing posts with the label Scripts

Add Class for Different Browser

    $(document).ready(function() {   if ((navigator.userAgent.indexOf("Opera") || navigator.userAgent.indexOf('OPR')) != -1) {     $('body').addClass('opera');   } else if (navigator.userAgent.indexOf("Chrome") != -1) {     $('body').addClass('chrome');   } else if (navigator.userAgent.indexOf("Safari") != -1) {     $('body').addClass('safari');   } else if (navigator.userAgent.indexOf("Firefox") != -1) {     $('body').addClass('firefox');   } else if ((navigator.userAgent.indexOf("MSIE") != -1) || (!!document.documentMode == true)) //IF IE > 10   {     $('body').addClass('IE');   } else {     $('body').addClass('unknown');   } });

Add more than one map in a same page using custom module in hubspot.

Html ================================== <div class="offices-group"> <h4 class="offices-heading">{{ module.heading }}</h4>   <div class="offices-wrapper">     {% for item in module.office_item %}     <div class="office-col">       <div class="office-inner">         <h5 class="office-title">{{ item.location }}</h5>         <p class="office-address">{{ item.address }}</p>         <div id="map-aux{{ loop.index }}" style="height: 325px; width: 100%;"></div>       </div>     </div>     {% endfor %}   </div> </div> ---------------------------------------------------------- JS ================================== <script src="map1.js"></script> <script>   {% for item in module.office_item %} function initMap{{ loop....

Active Menu Script

var path = window.location.href; $("a").each(function() {     var href = $(this).attr('href');     if (path == href) {     $(this).addClass('active');   } }); // Option Two if there are special characters being used for foreign pages  var url = window.location.pathname; urlRegExp = new RegExp(url.replace(/\/$/, '') + "$"); $("a").each(function() {     if (urlRegExp.test(this.href.replace(/\/$/, ''))) {         $(this).addClass('active');     } });

Add Fancybox Popup in Image Gallery

<link rel="stylesheet" href=" https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.1/jquery.fancybox.min.css " /> <script src=" https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.2.1/jquery.fancybox.min.js "></script> <script>    $(window).load(function() {    if ( $('.row1-content-careers ').length == 1 ){      $('.row1-content-careers .hs_cos_gallery .slick-slide-inner-wrapper').each(function(){        var imgSrc = $(this).children('img').attr('src') || $(this).children('img').attr('data-lazy');        var imgAlt = $(this).children('img').attr('alt');        $(this).children('img').wrap('<a href="'+ imgSrc +'" data-fancybox="images" title="' + imgAlt + '"></a>');      });    }  });  $(document).ready(function(){    $('[data-fancybox="images"]').fancybox({      margin : [44,0,22,...

Fatch Data From HubDB (Filter With Load More) Using Ajax

<!-- HubDB Html --> {% set tableId = 847400 %} <div class="row-fluid">     {% set types = hubdb_table_column(847400, "tag").options %}   <ul class="tag_list resources-tags">     <li value="all"><a class="tagall" href="{{ request.path }}">All</a></li>     {% for row in hubdb_table_rows(tableId)|uniq ue('tag_name')|sort(False, False, 'tag_name') %}     {% if row.tag_name %}         <li><a class="tag-filter" href="{{ request.path }}?tag={{ row.tag_name }}&page=1">{{ row.tag_name }}</a></li>       {% endif %} {% endfor %}   </ul> </div> {% set page_size = 10 %} {# Define Page Size Here #} {% set rowCount = hubdb_table(tableId).row_count %} {% set pageCount =(rowCount/page_size)|round(0, 'ceil') %} {% if request.query_dict.page %} {% set page_num = request.query_dict...

How To Remove Time From Date In Rss or other module

$('.custom-home-row1 .hs-rss-item').each(function(){ $(this).find('span.hs-rss-date').text($(this).find('span.hs-rss-date').text().split(' at')[0]); })

When You Want to open popup(first time load)

$(document).ready(function() {    if (localStorage.getItem("popState") != "shown") {        $('.service_modal_box').fadeIn();        localStorage.setItem("popState", "shown")    }    $(".sqs-popup-overlay-close").click(function(a) {        $(".service_modal_box").fadeOut()    }); });

Google Map Script

Check L atitude  & L ongitude  with  zoom  on live <div id=" map -aux" style="height: 440px; width: 100%;"></div> < script  src="// maps .google.com/ maps / api/js?sensor=false " type="text/javascript"></ script > < script > function initMap() {  var map2 = new google. maps . Map (document. getElementById(' map -aux'), {    zoom:  6 ,    center: { lat: 40.528106, lng:-3.65319 }  });  var marker2 = new google. maps .Marker({          position: { lat: 40.528106, lng:-3.65319 },           map : map2        });  var geocoder2 = new google. maps .Geocoder; <!--if u dont need to display address on  map  | remove this | iff needed then change address and link--> var infowindow2 = new google. maps .InfoWindow({       content : '<span style="col...

Back Menu JS

============================== ============================= BACK MENU JS (WITH SMOOTHNESS) ============================== ============================= ============================== ========= JS DEPARTMENT ============================== ========= <script> $(function() {     //===== Add js-enabled class in body     $('.custom-menu-primary'). addClass('js-enabled');     //========= add mobile-trigger     $('.custom-menu-primary'). after('<div class="mobile-trigger">Menu</ div>');     //========= add child-trigger     $('.custom-menu-primary .flyouts .hs-item-has-children > a').after(' <div class="child-trigger"><i></i>< /div>');     //========= wrap custom-menu-primary with a div     $('.custom-menu-primary'). wrapInner('<div class="inner-menu-section"></ div>');     //========= add back menu i...

Default Js

$(function() { /** * Mobile Nav * * Hubspot Standard Toggle Menu */ $('.custom-menu-primary').addClass('js-enabled'); /* Mobile button with three lines icon */ $('.custom-menu-primary .hs-menu-wrapper').before('<div class="mobile-trigger"><i></i></div>'); /* Uncomment for mobile button that says 'MENU' $('.custom-menu-primary .hs-menu-wrapper').before('<div class="mobile-trigger">MENU</div>'); */ $('.custom-menu-primary .flyouts .hs-item-has-children > a').after(' <div class="child-trigger"><i></i></div>'); $('.mobile-trigger').click(function() { $(this).next('.custom-menu-primary .hs-menu-wrapper').slideToggle(250); $('body').toggleClass('mobile-open'); $('.child-trigger')....