Connect with us

Blog

javascript – Dynamically changing navigation links

mm

Published

on

Suppose, if you have 5 target link and that have content on its navigation page and you want to fetch that content on target links clicks by using own custom paging then below code will help you, how to dynamically change navigation links by using HTML and JavaScript  code:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<style>

#left, #right {

    position: relative;

    float: left;

    margin: 0 5px 0 0;

    border: 1px solid black;

    width: 200px;

    height: 300px;

    overflow: hidden;

}

li.panel {

    position: absolute;

    height: 100%;

    width: 100%;

}

li:first-child {

    display:block !important;

}

li{ 

    display:none;

}
</style>
</head>
<body>
            
<div id="left">

    <a href="#target2" class="prev nav">Prev</a><br/>

    <a href="#target1" class="next nav">Next</a><br/>

</div>


<div id="right">

<ul>

    <li class="panel"  style="background:green">Target 1</li>

    <li class="panel"  style="background:red">Target 2</li>

    <li class="panel" style="background:blue">Target 3</li>

    <li class="panel"  style="background:blue">Target 4</li>

    <li class="panel"  style="background:blue">Target 5</li>

    </ul>

</div>

</body>

</html>
<script>
jQuery(function($) {

                var total_el = $('ul li').length,

                curr_el = $('ul li').eq(0),

                next_count = 1,

                prev_count = $('ul li').length-1;

				
    $('a.nav').click(function() {

                                if($(this).hasClass('next')){

                                                if(next_count != total_el){

                                                                $target = $('ul li').eq(next_count);

                                                                next_count += 1;

                                                }

                                                else{

                                                                return false;                                                      

                                                }

                                                var $other = $target.siblings('.active');

                                                if (!$target.hasClass('active')) {

                                                                $other.each(function(index, self) {

                                                                                var $this = $(this);

                                                                                $this.removeClass('active').animate({

                                                                                                left: $this.width()

                                                                                }, 500);

                                                                });

 

                                                                $target.addClass('active').show().css({

                                                                                left: -($target.width())

                                                                }).animate({

                                                                                left: 0

                                                                }, 500);

                                                }

                                }

                                else if($(this).hasClass('prev')){

                                                if(next_count != 0){

                                                                $target = $('ul li').eq(next_count-2);

                                                                next_count -= 1;

                                                }

                                                else{

                                                     return false;

                                                }

         var $other = $target.siblings('.active');

         if (!$target.hasClass('active')) {

            $other.each(function(index, self) {

                var $this = $(this);

                $this.removeClass('active').animate({

                    left: -($this.width())

                }, 500);

            });

            $target.addClass('active').show().css({

                right: $target.width()

            }).animate({

                left: 0

            }, 500);

        }

    }
 

    });

});

</script>

 

Also Read :   HTML Javascript

Hi, Thank you for reading my article. I am Victor, a professional blogger from Jaipur, India.I started webetutorial for blogging & sharing solution for developer questions, and now it’s empowering globally by helping them to make money.I am writing about starting & managing a blogs, WordPress, Magento, Social Media, SEO, Marketing, making money online, Investment, Finance, Gadgets, Fitness and more.

Continue Reading
Advertisement
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

eight + twelve =

Blog

Burj Al Arab Jumeirah – Luxurious Hotel in the World

mm

Published

on

Burj Al Arab Jumeirah – Luxurious Hotel in the World

Burj Al Arab Jumeirah is a world best luxurious hotel with their famous ultra-luxurious suites overlooking the sea. It is own island with nine signature restaurant. It has an opulent full-service spa and most attractive thing which guests may arrive to see the world’s largest chauffeur-driven fleets of Rolls-Royce’s.

The point which make luxurious to this property:

  • The roof terrace offers large swimming pools, 32 luxury cabanas same like a resort.
  • Floor have panoramic view of the Arabian Gulf
  • Each suite includes an iPad, WiFi, iMac and HD TV.
  • The hotel Bar is floating 200 m above sea level.
  • Guest may prefer to see sea in afternoon with tea and cocktails.
  • Talise Spa and ladies & gentlemen’s relaxation areas feature an aqua retreat.
  • It also includes separate indoor infinity pools facilities, hot tub and treatment room’s facilities, steam rooms and plunge pools facilities.
  • The property suite have private beach for special guests.
  • The property offers water sports activities at Wild Wadi Waterpark™.
Also Read :   Online Fashion Sale - Great Deals & Discounts on Fashion

Quick view on Property Amenities:

  • Pool
  • Room service
  • Restaurant
  • Free High Speed Internet (WiFi)
  • Fitness Centre with Gym / Workout Room
  • Free parking
  • Spa
  • Bar/Lounge
  • Adult pool
  • Airport transportation
  • Babysitting
  • Banquet Room
  • Breakfast Available
  • Business Centre with Internet Access
  • Children Activities (Kid / Family Friendly)
  • Concierge
  • Conference Facilities
  • Dry Cleaning
  • Heated pool
  • Hot Tub
  • Indoor pool
  • Laundry Service
  • Meeting rooms
  • Multilingual Staff
  • Non-smoking hotel
  • Outdoor pool
  • Sauna
  • Wheelchair Access

Quick view on Rooms:

  • Air conditioning
  • Minibar
  • Refrigerator in room
  • Accessible rooms
  • Family Rooms
  • Non-smoking rooms
  • Smoking rooms available
  • Suites

In the Dubai guests are getting more for their money when compared with other properties in the same location.

Subscribe us to get more hotels & resorts news or want to advertise your hostel with us, inquire now to get best quote from us.

Continue Reading

Trending