Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: Wrong Amenities block height on landing page in mobile view #800

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 31 additions & 38 deletions modules/wkhotelfeaturesblock/views/js/wkHotelFeaturesBlockFront.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,41 @@
* @license https://store.webkul.com/license.html
*/

$(document).ready(function(){
// For Block separator line in home page
if ($(".home_amenities_wrapper").length) {
// For width
var window_width = $(window).width();
var home_block_width = $(".home_amenities_wrapper").width() + 30;
var width_in_neg = ((window_width - home_block_width)/2);
//For Height()top
amenities_block_top = $(".home_amenities_wrapper .home_block_desc_wrapper").height() + 50;
$(".homeAmenitiesBlock").css({"left": -width_in_neg, "right": -width_in_neg, "top": amenities_block_top});
// home_amenities_wrapper height
var homeAmenitiesBlockHeight = $(".homeAmenitiesBlock").height();
$(".home_amenities_wrapper").css("height", (homeAmenitiesBlockHeight + amenities_block_top));
function setAmenitiesWrapperHeight() {
// for width
var window_width = $(window).width();
var home_block_width = $('.home_amenities_wrapper').width() + 30;
var width_in_neg = ((window_width - home_block_width)/2);

$(window).resize(function() {
// For width
var window_width = $(window).width();
var home_block_width = $(".home_amenities_wrapper").width() + 30;
var width_in_neg = ((window_width - home_block_width)/2);
// for height
amenities_block_top = $('.home_amenities_wrapper .home_block_desc_wrapper').height() + 50;
$('.homeAmenitiesBlock').css({'left': -width_in_neg, 'right': -width_in_neg, 'top': amenities_block_top});

//For Height(top)
amenities_block_top = $(".home_amenities_wrapper .home_block_desc_wrapper").height() + 50;
$(".homeAmenitiesBlock").css({"left": -width_in_neg, "right": -width_in_neg, "top": amenities_block_top});
// home_amenities_wrapper height
var homeAmenitiesBlockHeight = $('.homeAmenitiesBlock').height();
$('.home_amenities_wrapper').css('height', (homeAmenitiesBlockHeight + amenities_block_top));
}

// home_amenities_wrapper height
var homeAmenitiesBlockHeight = $(".homeAmenitiesBlock").height();
$(".home_amenities_wrapper").css("height", (homeAmenitiesBlockHeight + amenities_block_top));
});
function setAmenitiesDescContHeight() {
$('.amenity_desc_cont').each(function () {
var amenityDescParentHeight = $(this).parent('div.amenity_content').height();
$(this).css('height', amenityDescParentHeight);
});
}

$(document).ready(function() {
if ($('.homeAmenitiesBlock').length) {
setAmenitiesDescContHeight();
}
});

if ($(".homeAmenitiesBlock").length) {
$(".amenity_desc_cont").each(function(index) {
var amenityDescParentHeight = $(this).parent("div.amenity_content").height();
$(this).css("height", amenityDescParentHeight);
});
$(window).resize(function() {
if ($('.home_amenities_wrapper').length) {
setAmenitiesWrapperHeight();
}

$(window).resize(function(){
$(".amenity_desc_cont").css("height", 0);
$(".amenity_desc_cont").each(function(index) {
var amenityDescParentHeight = $(this).parent("div.amenity_content").height();
$(this).css("height", amenityDescParentHeight);
});
});
if ($('.homeAmenitiesBlock').length) {
$('.amenity_desc_cont').css('height', 0);
setAmenitiesDescContHeight();
}
});
});