Skip to content

Instantly share code, notes, and snippets.

@sosroInSpace
Created July 27, 2017 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sosroInSpace/831834ee59c5daee4103c161f336fb46 to your computer and use it in GitHub Desktop.
Save sosroInSpace/831834ee59c5daee4103c161f336fb46 to your computer and use it in GitHub Desktop.
Jquery Gist of Responsive Styling for Drupal site.
if( $(window).width() > 501) {
$(".header_menu .menuparent").mouseover(function(e){
$(this).children('ul').addClass('classX');
e.preventDefault();
return false;
});
$(".header_menu .menuparent").mouseout( function(e){
$(this).children('ul').removeClass('classX');
e.preventDefault();
return false;
});
$(".header_menu .menuparent ul").mouseover(function(e){
$(this).addClass('classX');
});
$(".header_menu .menuparent ul").mouseout( function(e){
$(this).removeClass('classX');
});
} else {
$(".header_menu .menuparent").click( function(e){
if ($(this).children('ul').hasClass("classX")) {
$(this).children('ul').removeClass('classX');
$(this).children('ul').addClass('classY');
}
else if ($(this).children('ul').hasClass("classY")) {
$(this).children('ul').removeClass('classY');
$(this).children('ul').addClass('classX');
} else {
$(this).children('ul').addClass('classX');
}
});
}
});
$(document).ready(function(){
$(function() {
var $body = $(document);
$body.bind('scroll', function() {
// "Disable" the horizontal scroll.
if ($body.scrollLeft() !== 0) {
$body.scrollLeft(0);
}
});
});
$("menu__link").click(function(){
$(".classX").slideToggle(600);
});
});
$(document).ready(function(){
$(".country_related_publications ul li a").each(function(){
$(this).find('img').wrap("<div class='rel-pub-div'></div>");
});
$(".country_related_publications ul li form").each(function(){
$(this).find('img').wrap("<div class='rel-pub-div'></div>");
});
});
$(document).ready(function(){
if ( $(window).width() > 1481 ) {
$(".newsOutlet li").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).find("p").css({"margin-top": "44%", "transition-duration": "1s"});
$(this).find("p").css("background", "rgba(51, 51, 51,0.7)");
});
$(".newsOutlet li").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).find("p").css("margin-top", "57%");
$(this).find("p").css("background", "rgba(7, 103, 162, 0.8)");
});
}
else if ( $(window).width() > 1438) {
$(".newsOutlet li").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).find("p").css({"margin-top": "46%", "transition-duration": "1s"});
});
$(".newsOutlet li").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).find("p").css("margin-top", "58.8%");
});
}
else if ( $(window).width() > 1360) {
$(".newsOutlet li").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).find("p").css({"margin-top": "46%", "transition-duration": "1s"});
});
$(".newsOutlet li").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).find("p").css("margin-top", "59%");
});
}
else if ( $(window).width() > 1272) {
$(".newsOutlet li").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).find("p").css({"margin-top": "50%", "transition-duration": "1s"});
});
$(".newsOutlet li").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).find("p").css("margin-top", "58%");
});
}
else if ( $(window).width() < 1025 ){
$(".newsOutlet li").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).find("p").preventDefault();/*comment*/
});
}
$(".newsLetterlatest").mouseover(function(){
$(this).find(".containingThis").css({"filter":"grayscale(85%)","transition":".2s"});
})
$(".newsLetterlatest").mouseout(function(){
$(this).find(".containingThis").css("filter","grayscale(0%)");
})
$(".climateFinance2").mouseover(function(){
$(this).find(".containingThis").css({"filter":"grayscale(85%)","transition":".2s"});
})
$(".climateFinance2").mouseout(function(){
$(this).css("background-color","rgba(255, 250, 240, 0.6)");
$(this).find("h2").css("color","#111");
$(this).find(".containingThis").css("filter","grayscale(0%)");
})
$(".servicesRelatedEdit ul li").mouseover(function(){
$(this).find("img").css({"transform":"scale(1.1","transition":".5s"});
})
$(".servicesRelatedEdit ul li").mouseout(function(){
$(this).find("img").css({"transform":"scale(1)","transition":".5s"});
})
$(".country_related_publications li").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).find("div").css({"transform": "scale(1.2)", "transition-duration": ".5s"});
});
$(".country_related_publications li").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).find("div").css("transform", "scale(1.0)");
});
$(".section-countries .content").ready(function(){
//$(this).find("li").css({"font-size": "15px"});
//$(this).find("div").css({"font-size": "15px"});
});
$(".node-type-topic .content").ready(function(){
//$(this).find("p").css({"font-size": "15px"});
// $(this).find("span").css({"font-size": "15px"});
});
});
$(document).ready(function(){
$("#aboutUsOne").mouseenter(function(){
$(".topSubMenu").fadeIn(200);
$("#topSubMenuThree").css("display","none");
});
$(".topSubMenu").mouseenter(function(){
$(this).css("display","block");
});
$(".topSubMenu").mouseleave(function(){
$(this).fadeOut(0);
});
$(".region-header").mouseleave(function(){
$(".topSubMenu").fadeOut(0);
});
$(".firstOut").mouseenter(function(){
$(".topSubMenu").fadeOut(0);
});
$("#partnerDevelopment").mouseenter(function(){
$("#topSubMenuThree").fadeIn(200);
$(".topSubMenu").css("display","none");
});
$("#topSubMenuThree").mouseenter(function(){
$(this).css("display","block");
});
$("#topSubMenuThree").mouseleave(function(){
$(this).fadeOut(0);
});
$(".topMenuTwo").mouseleave(function(){
$("#topSubMenuThree").fadeOut(0);
});
$("#contact").mouseenter(function(){
$("#topSubMenuThree").fadeOut(0);
});
$(".secondOut").mouseenter(function(){
$("#topSubMenuThree").fadeOut(0);
});
$("#mobilePop").click(function(){
$(".nice-menu-down").slideToggle(200);
});
$(".menu-681 a").click(function(){
$(".classX").toggle(00);
});
$(".menu-453 a").click(function(){
$(".classY").toggle(00);
});
/*cc*/
$("menu__link").click(function(){
$(".classX").slideToggle(600);
});
$(".resourceSub").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).find("h2").css("color", "#fff");
$(this).find("p").css("color", "#fff");
$(this).find("img").css({"transform":"scale(1.1)","box-shadow":"3px 3px 12px 0px rgba(0,0,0,0.75)"});
});
$(".resourceSub").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).find("h2").css("color", "#000");
$(this).find("p").css("color", "#000");
$(this).find("img").css({"transform": "scale(1.0)","box-shadow":"none"});
});
$(".creports ul li").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).css({"background": "#00a652", "transition-duration":".8s"});
$(this).find("a").css({"font-weight": "500","color":"#272a2b"});
$(this).find(".info").css({"color": "#fff", "font-weight": "500"});
$(this).find("img").css({"transform":"scale(1.2)","transition-duration":".9s"});
});
$(".creports ul li").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).css({"background": "#fff", "transition-duration":".5s"});
$(this).find("a").css({"font-weight": "200","color":"#385f8c"});
$(this).find(".info").css({"color": "#000"});
$(this).find("img").css("transform", "scale(1.0)");
});
$(".video").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).css({"background": "#42748c", "transition-duration":".8s", "margin-bottom":"-25px","font-weight":"200"});
$(this).find("div").css({"font-weight": "200","color":"#fff","transition":".7s"});
});
$(".video").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).css({"background": "#17ac60", "transition-duration":".5s","margin-bottom":"-60px"});
$(this).find("div").css({"font-weight": "200","color":"#00a652"});
});
$(".team").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).find("img").css({"filter": "grayscale(0%)","transition-duration":".3s",'box-shadow':" 10px 10px 14px 0px rgba(0,0,0,0.75)","transform":"scale(1.03)"});
});
$(".team").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).find("img").css({"filter": "grayscale(100%)","transition-duration":".3s","box-shadow":"none","transform":"scale(1)"});
});
$(".AboutPdf").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).find("img").css({"filter": "grayscale(100%)","transition-duration":".5s"});
$(this).find("h2").css({"color": "#333","transition-duration":".3s"});
});
$(".AboutPdf").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).find("img").css({"filter": "grayscale(0%)","transition-duration":".5s"});
$(this).find("h2").css({"color": "#fff","transition-duration":".5s"});
});
$(".climateFinance3").mouseover(function(){
//$(this).css("background-color", "#ff0000 !important"); console.log('in');
$(this).find("img").css({"filter": "grayscale(100%)","transition-duration":".5s"});
$(this).find("h2").css({"color": "#333","transition-duration":".3s"});
});
$(".climateFinance3").mouseout(function(){
//$(this).css("background-color", "#000 !important"); console.log('out');
$(this).find("img").css({"filter": "grayscale(0%)","transition-duration":".5s"});
$(this).find("h2").css({"color": "#fff","transition-duration":".5s"});
});
$(".climateFinance").mouseover(function(){
$(this).find(".containingThis").css({"filter":"grayscale(85%)","transition":".2s"});
});
$(".climateFinance").mouseout(function(){
$(this).find(".containingThis").css("filter","grayscale(0%)");
});
$(".view-news article").mouseover(function(){
$(this).find("a").css("color","#fff");
$(this).find("p").css("color","#fff");
$(this).find("em").css("color","#fff");
$(this).find("address").css("color","#fff");
});
$(".view-news article").mouseout(function(){
$(this).find("a").css("color","#333");
$(this).find("p").css("color","#333");
$(this).find("em").css("color","#333");
$(this).find("address").css("color","#333");
});
$(".page-events .view-events .views-row").mouseover(function(){
$('.page-node-3 .view-upcoming-events .views-field-field-event-location div, .page-events .view-events .views-field-field-event-location div').css("color","#333");
$(this).find("a").css("color","#364f5f");
});
$(".page-events .view-events .views-row").mouseout(function(){
$('.page-node-3 .view-upcoming-events .views-field-field-event-location div, .page-events .view-events .views-field-field-event-location div').css("color","#c3996b");
$(this).find("a").css("color","#fff");
});
$("#scrollDown i").click(function(event){
$('body').animate({scrollTop: '+=250px'}, 800);
});
$("#scrollUp i").click(function(event){
$('body').animate({scrollTop: '-=2250px'}, 800);
});
if ( $(window).width() > 739) {
$(".row-colum").mouseover(function(){
$(this).find("div").css({"color": "#fff","transition-duration":".5s", });
$(this).find("a").css({"color": "#fff","transition-duration":".5s", });
});
$(".row-colum").mouseout(function(){
$(this).find("a").css({"color": "#111","transition-duration":".5s", });
$(this).find("div").css({"color": "#111","transition-duration":".5s", });
});
}
else {
$(".row-colum").mouseover(function(){
$(this).find("img").css({"transform": "scale(1)","transition-duration":".5s", "margin-right":"5px"});
});
$(".row-colum").mouseout(function(){
$(this).find("img").css({"transform": "scale(1)","transition-duration":".5s", "margin-right":"5px"});
});
}
});
$(document).ready(function(){
$(".not-front #mce-EMAIL").attr("placeholder", "Email Address");
});
})(jQuery, Drupal, this, this.document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment