Dry Skin Around The Eyes: 15 Home Remedies To Treat It

Get rid of the itchy and flaky skin around your eyes with simple and effective tips.

Medically Reviewed by Vincent Marin, MD, FACS
By Ramona Sinha, Certified Skin Care Coach

What is dry skin around the eyes? How can you treat it? The skin surrounding your eyes is particularly delicate. It turns dry if not properly cared for. But poor treatment is not the only factor at work. Too much eye makeup, caffeine, insufficient sleep, pollution, and other external factors may overwhelm your eyes, making them look dull, weary, and gritty.

Furthermore, because the skin around your eyes is so fragile, you will not be able to hide the marks of negligence easily. Do not worry. Here’s a list of natural and simple home remedies for dealing with dry skin around the eyes.

What Causes Dry Skin Around The Eyes?

Multiple factors can be responsible for dry skin around your eyes, especially on your eyelids and the undereye area. The skin around your eyes can be dry, itchy, and flaky due to:

  • Weather conditions (low humidity and dry weather, especially during seasonal change)
  • Excessive use of hot water
  • Aging
  • Not removing makeup properly
  • Excessive rubbing
  • Harsh chemicals (present in soaps, skincare, and cosmetic products)

However, other underlying health factors can also cause dryness around your eyes and make the skin itchy and flaky. These include:

  • Contact Dermatitis

This is caused when your skin comes in contact with an irritant in your skincare or eye care products. Sunscreen, moisturizer, face wash, mascara, and styling products – anything can irritate your skin. Avoiding the products that irritate your skin can help treat contact dermatitis.

  • Atopic Dermatitis

This condition is characterized by redness, itching, and scaling on your skin. It is a chronic condition and can be caused by your immune system, triggered by the environment, or may run in your family. You need to consult a doctor to manage its symptoms.

  • Facial Psoriasis

Psoriasis makes your eyelids turn scaly (the scales usually cover the eyelashes) and the undereye area to become dry and crusty.

Visit a dermatologist if you have any of these conditions. They can assess your condition and suggest a proper remedy.

However, if the dry skin around your eyes is due to general neglect or any other reason, you can show it some love with home remedies. These remedies will keep the skin around your eyes nourished and hydrated. Scroll down to check them out.

Note: Please make sure that none of these ingredients go into your eyes. Also, test these remedies on the inner arm or wrist before applying under your eyes as there is a risk of an allergic reaction, and it can be dangerous around the eyes.

15 Home Remedies To Treat Dry Skin Around Your Eyes

  1. Aloe Vera Gel
  2. Almond Oil
  3. Vitamin E Oil
  4. Glycerin
  5. Vaseline Or Petroleum Jelly
  6. Green Tea Bags
  7. Avocado
  8. Honey
  9. Cucumber
  10. Milk
  11. Shea Butter
  12. Olive Oil
  13. Yogurt
  14. Milk Cream
  15. Rose Water

1. Aloe Vera Gel

Aloe vera hydrates and moisturizes your skin. It also promotes collagen production by stimulating fibroblasts, thus preventing wrinkles (1). This is especially beneficial for treating dry skin around your eyes.

You Will Need

1 tablespoon fresh aloe vera gel

Method
  1. Massage the aloe vera gel around your eyes, focusing on the dry parts.
  2. Leave it on overnight.
  3. Wash it off the next day.
  4. Repeat this every night.

2. Almond Oil

Almond oil is an excellent emollient that can heal dry skin. It is also beneficial in managing eczema and psoriasis (2).

You Will Need

A few drops of almond oil

Method
  1. Gently massage almond oil on the skin around your eyes.
  2. Leave it on overnight.
  3. Wash it off the next morning.
  4. Repeat this remedy every night.

3. Vitamin E Oil

Vitamin E is an excellent antioxidant. It boosts collagen production, has anti-aging effects, and reduces dark circles (3). It also keeps the skin around your eyes youthful and healthy.

You Will Need

2 vitamin E capsules

Method
  1. Burst the capsules open carefully and extract the oil.
  2. Massage the oil around your eyes.
  3. Leave it on overnight.
  4. Repeat this every night.

4. Glycerin

Glycerin keeps your skin hydrated and prevents dryness. A study found that glycerin containing cream was effective in treating atopic dry skin (4).

You Will Need
  • A few drops of glycerin
  • 2 cotton pads
Method
  1. Dab some glycerin on the cotton pads.
  2. Place the pads on your eyes.
  3. Leave them on for 5 minutes and then remove them.
  4. Leave the glycerin on your skin overnight.
  5. Wash it off the next morning.
  6. Repeat this every night.

5. Vaseline Or Petroleum Jelly

Petroleum jelly helps to prevent moisture loss from your skin (5). This property of petroleum jelly keeps your skin hydrated and prevents dryness. However, it is a bit greasy, which may be undesirable to some people.

You Will Need

½ teaspoon Vaseline or any petroleum jelly

Method
  1. Take a tiny amount of petroleum jelly on your fingertips.
  2. Gently massage it on your eye area.
  3. Keep it on overnight.
  4. Wash your face with lukewarm water the next morning.
  5. Apply this every night.

6. Green Tea Bags

Green tea has skin renewal and rejuvenating benefits (6). Although there is no evidence to prove the effectiveness of green tea in reducing dryness around the eyes, applying green tea bags on your skin can help prevent puffiness and dryness in the eye area.

You Will Need
  • 2 green tea bags
  • Water
Method
  1. Heat the water in a pan and pour it in a cup.
  2. Steep the two tea bags in hot water for a few minutes.
  3. Take them out and let them cool down.
  4. Place them over your eyelids.
  5. Leave the tea bags on for 15-20 minutes (or longer).
  6. Remove them and splash cool water on your eyes.
  7. Repeat the steps once daily (preferably before going to bed).

7. Avocado

Avocado oil is extremely nourishing for dry and damaged skin. Its topical application has shown to increase collagen synthesis in rat studies (7). This may help reduce the appearance of wrinkles around the eyes. Avocado pulp showed faster wound-healing properties in rat studies.

You Will Need

A few drops of avocado oil or 1 tablespoon avocado pulp (mashed)

Method
  1. If you are using avocado oil, massage the skin around your eyes gently with the oil.
  2. Leave it on overnight and wash it off the next morning.
  3. If you are using avocado pulp, apply the pulp around the eyes.
  4. Leave it on for 15-20 minutes.
  5. Use wet tissue to remove the pulp gently.
  6. Wash it off with lukewarm water.
  7. Repeat once every day before going to bed.

8. Honey

Honey has been used for healing and treating skin conditions since ancient times. Honey is extremely hydrating and an excellent emollient and humectant that keeps your skin healthy by preventing water loss and keeping it moisturized (8).

You Will Need

1 teaspoon organic or Manuka honey

Method
  1. Apply a very thin layer of honey on the skin around your eyes.
  2. Leave it on for 15-20 minutes.
  3. Wash it off with lukewarm water.
  4. Follow up with a hydrating eye cream.
  5. Repeat this routine every night.

9. Cucumber

Cucumber has a cooling effect on the skin. When applied to the eye area, it reduces dark circles, hydrates the skin, and reduces inflammation (9).

You Will Need
  • 4-5 tablespoons cucumber juice (grate a cucumber and extract the juice)
  • 2 cotton pads
Method
  1. Refrigerate the cucumber juice for half an hour.
  2. Soak the cotton pads with the juice.
  3. Place them on your eyes.
  4. Leave them on for 15-20 minutes.
  5. Remove the cotton pads.
  6. Rinse off the juice with cold water.
  7. Repeat this remedy every night.

10. Milk

Milk has a cooling effect on your skin. It keeps your skin nourished and hydrated. Milk contains lactic acid that can help improve skin texture and make it smooth (10).

You Will Need
  • Raw milk
  • 2 cotton pads
Method
  1. Dip the cotton pads in raw milk and place them on your eyes.
  2. Leave them on for 20 minutes.
  3. Remove the pads and wash your eyes with cold water.
  4. Repeat this once daily.

11. Shea Butter

Shea butter is often used in commercial moisturizers and skincare products for its hydrating, anti-inflammatory, and moisturizing benefits (11). Hence, shea butter can be used to heal the skin around your eyes.

You Will Need
  • 1 teaspoon raw shea butter
  • 1 vitamin E capsule (optional)
Method
  1. Squeeze out the vitamin E oil from the capsule and mix it with shea butter.
  2. Rub a bit of the mixture between your fingers.
  3. Massage it gently on the skin around your eyes.
  4. Leave it on overnight.
  5. Wash it off the next day.

12. Olive Oil

The topical application of olive oil has an anti-inflammatory effect on the skin. It reduces oxidative damage, heals your skin, and promotes dermal reconstruction (7).

You Will Need

A few drops of cold-pressed olive oil

Method
  1. Gently massage the olive oil on the area surrounding your eyes.
  2. Leave it on overnight.
  3. Wash it off with cool water the next morning.
  4. Repeat this every night.

13. Yogurt

Yogurt is often used in facial masks or applied on its own for its moisturizing benefits. It brightens your skin, calms it down, and improves its moisture levels (12).

You Will Need

1 tablespoon plain yogurt or curd

Method
  1. Apply yogurt around your eyes. Be careful not to get it in your eyes.
  2. Leave it on for 10-15 minutes.
  3. Wash it off with cool water.
  4. Repeat this once daily.

14. Milk Cream

Milk cream is a popular home remedy used for its moisturizing effects. It helps to keep the skin moisturized and youthful and leaves it feeling soft and smooth.

You Will Need

1 teaspoon milk cream or malai

Method
  1. Gently massage the milk cream into the skin around your eyes.
  2. Leave it on for 15-20 minutes.
  3. Use a soft tissue to wipe off the cream.
  4. Repeat this routine once daily.

15. Rose Water

Rose water rejuvenates your skin. It has an anti-inflammatory effect on your skin and helps reduce redness, puffiness, and inflammation (13). It may not prevent dryness, but it can help to keep the skin calm and rejuvenated. You can easily prepare rose water at home. Rosewater prepared at home is more beneficial than commercially available ones.

You Will Need
  • 2 tablespoons rose water
  • 2 cotton pads
Method
  1. Soak the cotton pads in rose water.
  2. Place them on your eyes.
  3. Leave them on for 15-20 minutes and relax.
  4. Remove the pads and repeat the same every night before going to bed.

Preventing dryness around your eyes is not a difficult task. Follow these remedies to take care of the skin around your eyes. Also, being a little careful with how you treat your skin and eyes can keep them healthy for long. Take a look at the precautions you need to follow to prevent dryness on the skin around your eyes.

How To Prevent Dryness Around Your Eyes – Tips To Follow

1. Keep Yourself Hydrated

Drinking water helps maintain the moisture balance in your body and prevents dryness.

2. Avoid Harsh Face Washes

Always opt for soap-free, hypoallergenic, and mild face washes. Such face washes don’t strain your skin or dry it out.

3. Keep The Eye Area Moisturized

Use a good eye cream to moisturize your eye area. Your regular face cream will not work on the delicate eye area; it needs specific products to stay healthy.

4. Avoid Rubbing Your Eyes

Since the skin around your eyes is delicate, rubbing it too hard or excessively can damage the capillaries and make your eyes look swollen and bruised.

5. Limit Your Sun Exposure

The harmful UV rays of the sun can cause fine lines, dryness, and wrinkling of the skin around your eyes (14). Always apply sunscreen on the area to keep it protected and wear sunglasses when you step out.

6. Remove Makeup Every Day

If you apply makeup on or around your eyes, make it a point to remove them properly every night before going to bed. Also, while buying cosmetics, make sure you are not allergic to them.

7. Avoid Certain Ingredients In Your Products

Avoid putting any product on your skin with parabens, lanolin, formaldehyde and formaldehyde-releasing agents, and fragrances. These often cause skin irritation and may lead to dryness around your eyes.

8. Avoid Scratching The Area Around Your Eyes

If your skin feels itchy and dry, do not scratch it. This may worsen the condition. Apply anti-itching cream or a hot or cold compress to reduce irritation.

Apart from these precautions, you also need to take care of your diet to improve your skin and overall health.

What To Eat And Avoid To Treat Dry Skin Around The Eyes

1. Consume Probiotics

These improve the overall health of your skin (15). Try including probiotics, such as fermented foods, yogurt, and sauerkraut, in your diet.

2. Follow A Balanced Diet

Following a balanced diet helps your body deal with a variety of health and skin conditions (16). Include fish, eggs, meat, vegetables, fruits, and whole grains in your diet. These foods are loaded with antioxidants that help in repairing damaged skin cells and improve your skin quality.

3. Include Essential Fatty Acids

Essential fatty acids protect the lipid layer of your skin and prevent it from drying out (17). That is why it is better to use unhydrogenated vegetable oils while cooking. Include canola oil and olive oil in your diet.

4. Consume Fiber-Rich Food

Fiber helps flush out the toxins from your body that have accumulated from environmental factors, such as dust and pollution. Eat foods such as whole-wheat bread, corn, kidney beans, apples, and Brussels sprouts to meet your daily fiber requirements.

Additionally, try to avoid processed, fried, and spicy foods. If your body is healthy from within, it shows on your skin.

Dry skin around the eyes is triggered due to various reasons like lack of skin care, insufficient sleep, pollution, and too much eye makeup. Moreover, since the skin around the eyes is delicate, it is more prone to dryness. This condition can be managed with aloe vera, almond oil, yogurt, rose water, shea butter, avocado, cucumber, vitamin E oil, green tea bags, and milk cream. In addition to these, following a few preventive tips, like staying hydrated and avoiding harsh face washes and rubbing your eyes, may help minimize the dryness around the eyes.

Frequently Asked Questions

Can allergies cause dry skin around the eyes?

Yes, they can. Consult a doctor and get yourself tested for allergies. You may get allergies from any topical ingredient or food.

How to soothe irritated skin around eyes?

Follow the home remedies, use topical ointments, and develop a good skincare routine, especially for the skin around your eyes.

Sources

Articles on StyleCraze are backed by verified information from peer-reviewed and academic research papers, reputed organizations, research institutions, and medical associations to ensure accuracy and relevance. Check out our editorial policy for further details.
Was this article helpful?
thumbsupthumbsdown
The following two tabs change content below.
author
Ramona is an editor at StyleCraze. Prior to that, she authored over 200 articles on skin and hair care. She... more

Vincent Marin

(MD, FACS )
Dr. Vincent Marin is a board-certified plastic surgeon and founder of Marin Aesthetics at La Jolla, San Diego. He is... more

LATEST ARTICLES

'; //load_ads_id = infinite_urls_id; if (jQuery) { if(page_load_value == null){ page_load_value = $('#infinitescrollcontent'+infinite_urls_id).data("nexturls"); manage_page_history(); } //alert("infinitescroll 1-1: "+current_page); //page_load_value = JSON.parse(page_load_value); if(Array.isArray(page_load_value)){ if(page_load_value.length > current_page){ var result = page_load_value[current_page].indexOf("|~|"); load_page_url = page_load_value[current_page].substring(0, result); current_postid = page_load_value[current_page].substring(result+3); //infinite_load_started = false; } //alert(load_ads_id); //alert(infinite_urls_id); //alert(load_page_url); //$("#infinitescroll"+infinite_urls_id).load(load_page_url+" #content",div_scroll_observer(current_postid,current_page,load_page_url)); if(page_load_value.length > current_page+1){ var result = page_load_value[current_page+1].indexOf("|~|"); next_page = page_load_value[current_page+1].substring(result+3); //To remove latest article var $myDiv = $("#scroll-content-containersc"); $myDiv.is("html *"); // returns true $myDiv.remove(); $myDiv = $(".relatedtitle"); $myDiv.is("html *"); // returns true $myDiv.remove(); $myDiv = $(".scroll-content-related related_posts_bottom_list"); $myDiv.is("html *"); // returns true $myDiv.remove(); //To remove next button $myDiv = $("#next-story"); $myDiv.is("html *"); // returns true $myDiv.remove(); } if(next_page !== false){ $.get(load_page_url, "", function (responseText) { /*responseText = responseText.replace("#ts-fab-latest-posts-","#ts-fab-latest-posts-"+current_postid); responseText = responseText.replace("#ts-fab-bio-","#ts-fab-bio-"+current_postid); responseText = responseText.replace("#ts-fab-reviewer-","#ts-fab-reviewer-"+current_postid); responseText = responseText.replace("ts-fab-latest-posts-","ts-fab-latest-posts-"+current_postid); responseText = responseText.replace("ts-fab-bio-","ts-fab-bio-"+current_postid); responseText = responseText.replace("ts-fab-reviewer-","ts-fab-reviewer-"+current_postid); */ var dom_nodes = $($.parseHTML(responseText)); //$related_article = dom_nodes.find('#scroll-content-containersc').remove(); var result = dom_nodes.find('#content').html(); if(isEmpty(result)){ let next_btn_x = document.getElementById("next-story"); next_btn_x.style.setProperty("display", "none", "important"); }else{ $("#infinitescroll"+load_ads_id).html(separator_html ); $("#infinitescroll"+load_ads_id).append(result); console.log("current-postid: "+ infinite_urls_id); //To send GA event ga('send', 'event', 'InfiniteScrollDepth', "scroll depth " + current_page, load_page_url); //alert("infinitescroll 1-2: "+load_page_url); current_page = current_page + 1; div_scroll_observer(current_postid,current_page,load_page_url); } }); } if(current_postid != ''){ infinite_urls_id = current_postid; //console.log("updated-postid: "+ infinite_urls_id); } //loadMore(load_page_url,infinite_urls_id); //setTimeout(infinitescrollscript(current_postid),10000); } }else{ // Load the script const script = document.createElement("script"); script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js'; script.type = 'text/javascript'; script.addEventListener('load', () => { //alert('Jquery Loaded'); if(page_load_value == null){ page_load_value = $('#infinitescrollcontent'+infinite_urls_id).data("nexturls"); manage_page_history(); } //alert("infinitescroll 1-1: "+current_page); //page_load_value = JSON.parse(page_load_value); if(Array.isArray(page_load_value)){ if(page_load_value.length > current_page){ var result = page_load_value[current_page].indexOf("|~|"); load_page_url = page_load_value[current_page].substring(0, result); current_postid = page_load_value[current_page].substring(result+3); //infinite_load_started = false; } /*if(next_page != ''){ infinite_urls_id = next_page; }*/ //alert(load_ads_id); //alert(infinite_urls_id); //alert(load_page_url); //$("#infinitescroll"+infinite_urls_id).load(load_page_url+" #content",div_scroll_observer(current_postid,current_page,load_page_url)); if(page_load_value.length > current_page+1){ var result = page_load_value[current_page+1].indexOf("|~|"); next_page = page_load_value[current_page+1].substring(result+3); //To remove latest article var $myDiv = $("#scroll-content-containersc"); $myDiv.is("html *"); // returns true $myDiv.remove(); $myDiv = $(".scroll-content-related related_posts_bottom_list"); $myDiv.is("html *"); // returns true $myDiv.remove(); $myDiv = $(".relatedtitle"); $myDiv.is("html *"); // returns true $myDiv.remove(); //To remove next button $myDiv = $("#next-story"); $myDiv.is("html *"); // returns true $myDiv.remove(); } if(next_page !== false){ $.get(load_page_url, "", function (responseText) { /*responseText = responseText.replace("#ts-fab-latest-posts-","#ts-fab-latest-posts-"+current_postid); responseText = responseText.replace("#ts-fab-bio-","#ts-fab-bio-"+current_postid); responseText = responseText.replace("#ts-fab-reviewer-","#ts-fab-reviewer-"+current_postid); responseText = responseText.replace("ts-fab-latest-posts-","ts-fab-latest-posts-"+current_postid); responseText = responseText.replace("ts-fab-bio-","ts-fab-bio-"+current_postid); responseText = responseText.replace("ts-fab-reviewer-","ts-fab-reviewer-"+current_postid); */ var dom_nodes = $($.parseHTML(responseText)); //$related_article = dom_nodes.find('#scroll-content-containersc').remove(); var result = dom_nodes.find('#content').html(); if(isEmpty(result)){ let next_btn_x = document.getElementById("next-story"); next_btn_x.style.setProperty("display", "none", "important"); }else{ $("#infinitescroll"+load_ads_id).html(separator_html ); $("#infinitescroll"+load_ads_id).append(result); console.log("current-postid: "+ infinite_urls_id); //To send GA event ga('send', 'event', 'InfiniteScrollDepth', "scroll depth " + current_page, load_page_url); //alert("infinitescroll 1-2: "+load_page_url); current_page = current_page + 1; div_scroll_observer(current_postid,current_page,load_page_url); } }); } //loadMore(load_page_url,infinite_urls_id); //setTimeout(infinitescrollscript(current_postid),10000); if(current_postid != ''){ infinite_urls_id = current_postid; //console.log("updated-postid: "+ infinite_urls_id); } } // use jQuery below }); document.head.appendChild(script); } } function infinitescrollscript(current_page_scroll){ //alert("infinitescrollscript: "+current_page_scroll); var config={threshold:0.01};deferimg('.lh-lazy-image',1,'lazied',function(){},config); googletag.destroySlots(); show_google_ads_script_single(current_page_scroll); googletag.pubads().refresh(); /* let elements = document.getElementsByClassName('ts-fab-tab'); for (let i = 0; i { doctor_author_bio(load_ads_id); }, 3000); //setTimeout(doctor_author_bio(load_ads_id),5000); /*window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'infinitescrolldepth', 'eventCategory': 'scroll depth '+page_loaded_count });*/ //alert('#div_scroll_observer: '+load_ads_id); //page_loaded_count = page_loaded_count+1; setTimeout(() => { $(window).scroll(function() { if(!infinite_load_started) { var hT = $('#infinitescrollcontent'+load_ads_id).offset().top, hH = $('#infinitescrollcontent'+load_ads_id).outerHeight(), wH = $(window).height(), wS = $(this).scrollTop(); if (wS > (hT+hH-wH)){ infinitescrollcontent(current_page); infinite_load_started = true; } } }); },3000); var history_url = load_page_url; history.pushState('','',history_url); //To dsable existing ts-fav-tabs window.hideFsTabs = function(){}; window.setupFab = function(){}; //for (var e = document.querySelectorAll("div.ts-fab-tabs > div"), t = 0; t div:first-child") != null){document.querySelector("div.ts-fab-tabs > div:last-child").style.display = "block", document.querySelector("ul.ts-fab-list li:last-child").classList.add("active");} /*if(document.querySelector("div.ts-fab-tabs > div:first-child") != null){ document.querySelector("div.ts-fab-tabs > div:first-child").style.display = "block" document.querySelector("div.ts-fab-tabs > div:last-child").style.display = "none" document.querySelector("ul.ts-fab-list li:first-child").classList.add("active"); document.querySelector("ul.ts-fab-list li:last-child").classList.remove("active"); } */ /*for (var e = document.querySelectorAll("ul.ts-fab-list li a"), t = 0; t = 0){ $('.ts-fab-reviewer-link-'+temp_pr_id).removeClass('active'); $('.ts-fab-bio-link-'+temp_pr_id).addClass('active'); $('#ts-fab-bio-' + temp_pr_id).css("display", "block"); $('#ts-fab-reviewer-' + temp_pr_id).css("display", "none"); }else if(temp_pr_href.indexOf("ts-fab-reviewer") >= 0){ $('.ts-fab-reviewer-link-'+temp_pr_id).addClass('active'); $('.ts-fab-bio-link-'+temp_pr_id).removeClass('active'); $('#ts-fab-bio-' + temp_pr_id).css("display", "none"); $('#ts-fab-reviewer-' + temp_pr_id).css("display", "block"); } }); } function loadInfiniteJquery(){ // Load the script if (!jQuery) { const script = document.createElement("script"); script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js'; script.type = 'text/javascript'; script.addEventListener('load', () => { //alert('Jquery Loaded'); loadNextScrollButton(); // use jQuery below }); document.head.appendChild(script); }else{ loadNextScrollButton(); } } function loadNextScrollButton(){ $("#next-story").show("slow").delay(5000).hide("slow"); /*var next_btn_x = document.getElementById("next-story"); if (next_btn_x.style.display === "none") { //next_btn_x.style.display = "block !important"; next_btn_x.style.setProperty("display", "block", "important"); } else { setTimeout(function() { var next_btn_x = document.getElementById("next-story"); next_btn_x.style.setProperty("display", "none", "important"); }, 4000); }*/ //alert("scroll percentage:" + previousPercentage); document.getElementById("INFINITE_NEXT_BTN").addEventListener("click", function(){ //alert("button lciked"); //infinitescrollcontent(window.current_page); document.querySelector('.ts-fab-wrapper').scrollIntoView({ behavior: 'smooth' }); //To hide next button permanently let next_btn_x = document.getElementById("next-story"); next_btn_x.style.setProperty("display", "none", "important"); let ele_url = $('.ts-fab-wrapper').attr("data-url"); ga('send', 'event', 'next page',ele_url); /* var $currentElement = $(".ts-fab-wrapper").first(); $("#INFINITE_NEXT_BTN").click(function () { var $nextElement = $currentElement.next('.ts-fab-wrapper'); // Check if next element actually exists if($nextElement.length) { // If yes, update: // 1. $currentElement // 2. Scroll position $currentElement = $nextElement; $('html, body').stop(true).animate({ scrollTop: $nextElement.offset().top }, 2000); } return false; });*/ }); /* setInterval(() => { var config={threshold:0.01};deferimg('.lh-lazy-image',1,'lazied',function(){},config); }, 2000);*/ } function manage_page_history(){ $.fn.isInViewport = function() { var elementTop = $(this).offset().top; var elementBottom = elementTop + $(this).outerHeight(); var viewportTop = $(window).scrollTop(); var viewportBottom = viewportTop + $(window).height(); return elementBottom > viewportTop && elementTop = delta){ if (nowScrollTop > lastScrollTop){ $('.entry-title').each(function(i, obj) { //console.log("windows scroll called"); if ($(obj).isInViewport()) { //let ele_id = $(obj).attr("id"); let ele_url = $(obj).attr("data-url"); //console.log("visible id: "+ ele_url); if(isEmpty(ele_url)){}else{ history.pushState('','',ele_url); } } }); } else { $('.ts-fab-wrapper').each(function(i, obj) { //console.log("windows scroll called"); if ($(obj).isInViewport()) { //let ele_id = $(obj).attr("id"); let ele_url = $(obj).attr("data-url"); //console.log("visible id: "+ ele_url); if(isEmpty(ele_url)){}else{ history.pushState('','',ele_url); } } }); } lastScrollTop = nowScrollTop; } setTimeout(() => { changestart = 0; }, 300); } }); } function isEmpty(str) { return (!str || str.length === 0 ); }