I made a wordpress theme with bootstrap, it uses carousel and affix.
Now, when the carousel changes slide, the .affix isn't working over that period, when the carousel has finished the transition, the div with position:fixed is displayed correctly again.
You can check it here:
http://hu.rundertisch.org/?page_id=106
The navigation on the left side gets the position:fixed when you scroll to the bottom.
Just wait until the transition of the background image starts then scroll down. You see that the menu isn't moving with the screen. When the transition finished try again and you will see the difference.
I also have this problem with normal div's that have position:fixed like the wordpress top-admin bar that is displayed when you log-in. It just doesn't scroll witht he screen when a transition is going on.
This is my application.js that is included just before the (and wp_footer) tag, it is the last js file that I include after the whole bootstrap js files:
!function ($) {
$(function(){
var $window = $(window)
setTimeout(function () {
$('#af-me').affix({})
$('#ad-box-1').affix({offset: 580})
}, 100)
$('#running-box, #bg-car').carousel({})
$('#klapp').on('show', function () {
$("html, body").animate({ scrollTop: $(document).height() }, 365);
$('#col-switch').text("Becsukni");
})
$('#klapp').on('hide',function () {
$('#col-switch').text("Kinyitni");
})
$('a').click(function(){
$('html, body').animate({
scrollTop: $( $(this).attr('href') ).offset().top
}, 500);
return false;
});
$('#top').on('click',function () {
$("html, body").animate({ scrollTop: 0 }, 360);
})
$(".stop-car").hover(
function(){
$('#running-box, #bg-car').carousel('pause');
},
function() {
$('#running-box, #bg-car').carousel('cycle');
}
);
})
}(window.jQuery)
Related
I have a div that is conditionally binded to a class in vueJS. The formula for my computed variable uses Screen.width. It seems to work correctly when first loading, but if I change the size of the screen it doesn't rebind with the new screen size, unless I refresh the page. Is there a way I can get my conditionally binding to honor the change in screen?
<div class="div_1" v-bind:class="{ horizontalScroll : showScroll }"/>
showScroll(){
return this.events.length*225>(screen.width*.84);
}
If you wanna do it this way, you will probably have to register a 'resize' listener. Your code should look something like this:
data: () => ({
windowWidth: document.documentElement.clientWidth,
windowHeight: document.documentElement.clientHeight
}),
mounted() {
window.addEventListener('resize', this.setDimensions);
},
methods: {
setDimensions() {
this.windowWidth = document.documentElement.clientWidth;
this.windowHeight = document.documentElement.clientHeight;
},
}
and don't forget to remove it:
beforeDestroy() {
window.removeEventListener('resize', this.setDimensions);
},
I want to use the hide() function of jquery to hide messages that are flashing on a page.
When I load the page, I want to display it for 5 sec then make it disapear.
$('#flash-message').show("clip");
setTimeout(function() {
$("#flash-message").hide("clip", { direction: 'vertical' }, 1000);
}, 5000);
It doesn't do the "animation" if I use a fixed or absolute position and I need to put the message on top of the page with a fixed position.
Is there a work around for that? Thanks for your help
To call events when the page loads use:
$(document).ready(function(){
//code here
});
If you only want to use "clip" try this:
$("#flash-message").hide("clip", {direction: "vertical"}, 5000)
or else try using animate:
$('#flash-message').animate({
opacity: 0.25,
direction: "left",
}, 5000, function() {
$(this).hide();
});
Or something more simple:
$("#flash-message").click(function() {
$("#flash-message").fadeOut("slow");
});
I'm working on a Wordpress template with an animation on the frontpage. The animation loads the frontpage content (banner and newsletter) when you scroll. I wan't to remove the animation, but I can't find out in which CSS file the animation script is hided. Can anybpody please help me?
Thanks :))
http://funwithfelix.com/
Found inside helper.js
// Initializing waypoints to show/hide flowign panel above header
jQuery(document).ready(function($){
$(window).load(function(){
$('.site-header').waypoint(function(direction) {
if (direction == 'down') {
$('.panel-hidden').fadeIn();
} else {
$('.panel-hidden').fadeOut();
}
}, {
offset: function() {
return -$(this).height();
}
});
});
});
I've tried everything I can think of to get the tooltip by the hovered-over event. But for whatever reason it just appears every time in the top left corner of my browser window.
Here is my javascript:
$(document).ready(function(){
var tooltip = $('<div/>').qtip({
id:'myCalendar',
prerender:true,
content:{
text:' ',
title:{
button:true,
},
},
position:{
my:'center left',
at:'center right',
target:'mouse',
viewport:$('#myCalendar'),
adjust:{
mouse:false,
scroll:false,
},
},
show:false,
hide:false,
style:'qtip-light',}).qtip('api');
$('#myCalendar').fullCalendar({
editable:true,
eventMouseout:function(e,j,v){
tooltip.hide();
},
eventMouseover:function(e,j,v){
var event = '<h3>'+e.title+'</h3>';
tooltip.set({'content.text':event,}).reposition(e).show(e);
},
events:[{title:'All Day Event',start:new Date(y,m,1)}],
header:{left:'prev,next today',center:'title',right:'month,agendaWeek,agendaDay'},
});
});
I'm using all of the same javascript and css linked from this example on jsfiddle:
http://jsfiddle.net/craga89/N78hs/
Can someone spot where I'm going wrong?
I couldn't ever get the code above to work, so I decided to go a different route and use the render event instead. Now it works exactly as I wanted by putting the qtip in the middle of the right side of each fullcalendar event on mouse over.
$(document).ready(function(){
$('#myCalendar').fullCalendar({
editable:true,
eventRender:function(event,element,view){
element.qtip({
content:{
text:'<h3>'+event.title+'</h3>',
},
position:{
my:'center left',
at:'center right'
},
show:'mouseover',
});
},
events:[{title:'All Day Event',start:new Date(y,m,1)}],
header:{left:'prev,next today',center:'title',right:'month,agendaWeek,agendaDay'},
});
});
I still don't know why using this code works as expected. Note: I didn't change any of the stylesheets or javascript included with either fullcalendar or qtip, just something about how the code above was implemented improperly.
I have a problem where my Google Maps is only showing top tiles (much like this issue PhoneGap + JQuery Mobile + Google Maps v3: map shows Top Left tiles?) but in iOS and with jQuery UI Map.
However this only occurs after I play around with the app for some time switching tabs (it works fine on a Desktop Browser, only fails on the Device App)
I've tried several solutions from other posts (as you can see from the code) but my problem is a bit different, as it doesn't happen at first
Here is my HTML
<div data-role="page" id="page3" data-url="page3" tabindex="0" style="padding-bottom:19px">
....
<div data-role="content" id="ct">
<div id="map_canvas" style="height:100%"></div>
</div>
....
</div>
And JS
$(document).bind('pagechange', function () {
if ($.mobile.activePage.attr('id') === 'page3') {
if (!mapInited) {
mapInited = true;
$('#map_canvas').gmap().bind('init', function () {
var bounds = new google.maps.LatLngBounds();
navigator.geolocation.getCurrentPosition(locSuccess, locError);
$.each(markers, function (i, marker) {
var latlong = new google.maps.LatLng(marker.latitude, marker.longitude);
bounds.extend(latlong);
$('#map_canvas').gmap('addMarker', {
'position': latlong,
'bounds': true,
'primaryColor': "#0000FF",
'icon': './img/train.png'
}).click(function () {
$('#map_canvas').gmap('openInfoWindow', {
'content': marker.content
}, this);
});
});
$('#map_canvas').css('height', getRealContentHeight());
$('#map_canvas').css('width', '100%');
google.maps.event.trigger($('#map_canvas'), "resize");
setTimeout(function () {
google.maps.event.trigger($('#map_canvas'), 'resize');
}, 500);
});
}
}
});
}
Thanks in advance for any thoughts
"Fixed" the issue with a very ugly work around
Basically I recreate the Map everytime the page is loaded, like this
if (!mapInited) mapInited = true;
else { $('#map_canvas').remove(); $('#ct').append('<div id="map_canvas" style="height:100%"></div>'); }
You trigger the resize-event for a jQuery-object, what will not have any effect, because you must trigger the event for the google.maps.Map-instance:
google.maps.event.trigger($('#map_canvas').gmap('get','map'),'resize');
You may also use the plugin-method triggerEvent to trigger the event:
$('#map_canvas').gmap().triggerEvent('resize');
If you are using jquery-ui-map, why are you using the native google maps api instead of the gmap functions?
Why not call the $('#map_canvas').gmap('refresh');